Nginx forward proxy configuration example

June 27, 2021 1138 points heat 1 person likes 1 comment

Nginx forward proxy configuration reference is applicable to intranet servers connecting to the Internet through proxy,

Strictly speaking, it may not meet the requirements of equal protection 2.0 specification. Please confirm with your company before using the project of public institutions

 ##Example of HTTP proxy configuration server{ resolver 119.29.29.29;            # Configure DNS for domain name resolution resolver_ timeout 5s;              # Domain name resolution timeout (5 seconds) listen 8079;                    # Listening port access_ log  /usr/local/nginx/logs/reverse.access.log  main; error_ log   /usr/local/nginx/logs/reverse.error.log  warn; location / { proxy_ pass http://$http_ host$request_ uri; # Configure forward proxy parameters proxy_ set_ header Host $http_ host;        # Resolve the Nginx 503 error after the URL contains a "." proxy_ buffers 256 4k;            # Configure cache size proxy_ max_ temp_ file_ size 0;      # Turn off disk cache read and write to reduce I/O proxy_ connect_ timeout 30;        # Proxy connection timeout proxy_ cache_ valid 200 302 0m; proxy_ cache_ valid 301 0h; proxy_ cache_ valid any 0m;            # Configure proxy server cache time } }

Test:

 curl  http://ip.vv1234.cn/  -x 172.xx.xx.211:8079

 

Gcod

If life is just like the first sight, what is the sad autumn wind painting fan

Article comments

  • ChuHai5

    Like a......

    September 29, 2021