nginx同样可以实现代理上网的功能,配置如下:
user www;worker_processes 1;error_log /var/log/nginx/error.log debug;events {use epoll;worker_connections 1024;}http {resolver 8.8.8.8;server {listen 8088;location / {proxy_pass http://$http_host$request_uri;}}}
nginx实现代理上网,有三个关键点必须注意,其余的配置跟普通的nginx一样
1.增加dns解析resolver
2.增加无server_name名的server
3.proxy_pass指令
具体实现步骤:
1.把如下配置填到你的配置文件http作用域
resolver 8.8.8.8;server {listen 8088;location / {proxy_pass http://$http_host$request_uri;}}
2.重启nginx使配置文件生效
3.设置ie代理
4.可以使用代理上网了。
可以访问http://ip.quancha.cn检测代理是否生效
使用nginx代理上网后
使用nginx代理上网前
