nginx正向代理默认只支持http,不支持https,需借助第三方模块“ngx_http_proxy_connect_module”来实现(https://github.com/chobits/ngx_http_proxy_connect_module)
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-develpatch -p1 </newData/soft/ngx_http_proxy_connect_module-master/patch/proxy_connect_rewrite_1018.patch./configure --prefix=/usr/local/nginx2 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads --add-module=/newData/soft/ngx_http_proxy_connect_module-mastermake & make installnginx配置同时支持http和httpsserver {resolver 8.8.8.8;listen 8082;proxy_connect;location / {proxy_http_version 1.1;proxy_buffering off;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Scheme $scheme;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_ssl_server_name on;proxy_pass $scheme://$host$request_uri;proxy_set_header HOST $host;}}
如果碰到这种错误
make[1]: *** No rule to make target ‘objs/addon/ngx_http_mytest2/ngx_http_mytest2_module.o’, needed by ‘objs/nginx’. Stop.
1.确认上面安装的nginx模块是否都正确
2.ngx_http_proxy_connect_module-master 如果是从windows上拷过去,可能会有些文件不正确,需仔细确认