Skip to content
nginx
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout 60;

    server {
        listen       80;
        server_name  120.78.79.181;
        # 用于解析域名
        resolver 223.5.5.5;

        location / {
	          proxy_pass $scheme://$host$request_uri;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

Window 设置 => 网络和 Internet => 代理 => 手动代理 => 120.78.79.181 80

查看 IP,发现变成了服务器的地址,正向代理成功。

访问 https 时失败,通过第三方模板 ngx_http_proxy_connect_module 解决。

https://github.com/chobits/ngx_http_proxy_connect_module