Scenarios where a forward proxy is used, and the difference between a forward proxy and a reverse proxy:

Client Proxy Server A B C Forward: * B C Reverse: A B *

Hide the client forward and hide the server backward

1 View the document

 https://github.com/chobits/ngx_http_proxy_connect_module/blob/master/README.md

Where: Built as a dynamic module

Install the nginx and nginx_proxy_connect modules

Starting with NGINX’s 1.9.11, you can also be a dynamic module by using the –add-dynamic-module=PATH option for compiling the module instead of –add-module=PATH on the./configure command line. $ $ wget http://nginx.org/download/ngi… $tar-xzvf nginx-1.9.12.tar.gz $CD nginx-1.9.12/ $patch-p1 < /path/to/ngx_http_proxy_connect_module/patch/proxy_connect.patch $ ./configure –add-dynamic-module=/path/to/ngx_http_proxy_connect_module $ make && make install

3. Problems that make may encounter

1 error: this statement may fallthrough [-werror =implicit-fallthrough=] 2 “SRC/OS/Unix /ngx_user.c:26:7: error: Struct crypt_data has no member named ‘current_salt’

Problem 1 solved, comment out this line

/opt/nginx/nginx-1.9.2/ SRC/OS/Unix /ngx_user.c 36: / cd.current_salt[0] = ~salt[0]; /

Make CFlags =’ -wno-implicit-fallthrough ‘; make install;

4. Configure conf:

vim /usr/local/nginx/conf/nginx.conf

#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #access_log logs/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; server { listen 88; # monitor port resolver 183.60.82.98; Server_name _; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass https://$host$request_uri; Proxy_set_header HOST $HOST; proxy_set_header HOST $HOST; proxy_buffers 256 4k; proxy_max_temp_file_size 0k; proxy_connect_timeout 30; proxy_send_timeout 60; proxy_read_timeout 60; proxy_next_upstream error timeout invalid_header http_502; #root html; #index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }} server {resolver 8.8.8.8; # DNS Listen 89; # proxy_connect listener port; proxy_connect_allow 443 563; location / { proxy_pass $scheme://$host$request_uri; Proxy_set_header HOST $HOST; proxy_set_header HOST $HOST proxy_buffers 256 4k; proxy_max_temp_file_size 0k; proxy_connect_timeout 30; proxy_send_timeout 60; proxy_read_timeout 60; proxy_next_upstream error timeout invalid_header http_502; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }}}

Start the nginx

Curl-i — Proxy 192.168.3.17:89 www.baidu.com

Results: