Nginx 虚拟主机及正向代理设置
添加虚拟主机
# vim /usr/local/nginx-1.9.0/conf/vhost/proxy.conf
server { resolver 8.8.8.8; listen 8088; location / { proxy_pass http://$http_host$request_uri; } }
nginx实现代理上网,有三个关键点必须注意,其余的配置跟普通的nginx一样
1.增加dns解析resolver
2.增加无server_name名的server
3.proxy_pass指令
# vim /usr/local/nginx-1.9.0/conf/nginx.conf
# 添加如下信息
include vhost/*.conf;
参考:http://www.neoease.com/nginx-virtual-host/
http://www.nginx.cn/482.html