一、nginx正向代理配置:
本次配置的代理服务器在linux环境下;
使用默认配置文件/usr/local/conf/nginx.conf:
cat /etc/resolv.conf可以看到
search localhost
nameserver 8.8.8.8
此为dns服务器
因此,在nginx配置文件中配置如下localtion项:
#location / {
# root html;
# index index.html index.htm;
#}
把默认的注释掉,然后
location / {
resolver 8.8.8.8;
proxy_pass $scheme://$http_host$request_uri;
allow 172.20.30.187;
deny all;
}
配置完后到/usr/local/sbin下./nginx -s reload加载配置;
nginx支持的操作可以通过nginx -h或-?看;
二、客户端
windows下客户端设置代理服务指向刚刚配置的机器地址即可;
nginx不支持connect,所以,不支持代理https连接,网银等安全连接通过ngxi代理就不能用了;
如果还有其他代理服务器支持安全连接的话,可以在客户端网络配置里单独配置https连接的代理服务器地址;
nginx还是做反向吧,正向的话网上说可以尝试squid、apache,这里先折腾nginx。