配置 http 反向代理

[root@nginx ~]# cd /etc/nginx/

1

[root@nginx nginx]# cp nginx.conf nginx.conf.bak #备份一个原配置文件

2

[root@nginx nginx]# vim nginx.conf

3

location / {

4

proxy_pass     http://192.168.18.201;

5

}

6

指令说明:proxy_pass

语法:proxy_pass URL

默认值:no

使用字段:location, location 中的 if 字段 这个指令设置被代理服务器的地址和被映射的 URI,地址可以使用主机名或 IP 加端 口号的形式,例如:proxy_pass http://localhost:8000/uri/;

8.重新加载一下配置文件

[root@nginx ~]# service nginx reload

1  nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

2  nginx: configuration file /etc/nginx/nginx.conf test is successful

3  重新载

4  入 nginx:

[确定]

猜你喜欢

转载自www.cnblogs.com/fanweisheng/p/11333417.html