NGINX Proxy Configuration: Pass Requests to Backend Server
This configuration is used in an NGINX server block to proxy requests to a backend server. Here's a breakdown of each directive:
-
proxy_pass http://ws-28992/ws;: This directive specifies the backend server to which the requests should be proxied. In this case, the server address ishttp://ws-28992/ws. -
proxy_http_version 1.1;: This directive sets the HTTP version used in the proxy request. It is set to version 1.1 here. -
proxy_set_header Upgrade $http_upgrade;: This directive sets theUpgradeheader in the proxy request to the value of theUpgradeheader in the original client request. -
proxy_set_header Connection $connection_upgrade;: This directive sets theConnectionheader in the proxy request to the value of theConnectionheader in the original client request. -
proxy_set_header Host $host;: This directive sets theHostheader in the proxy request to the value of the$hostvariable, which represents the hostname of the server. -
proxy_set_header X-Real-IP $remote_addr;: This directive sets theX-Real-IPheader in the proxy request to the IP address of the client making the request. -
proxy_set_header REMOTE-HOST $remote_addr;: This directive sets theREMOTE-HOSTheader in the proxy request to the IP address of the client making the request. -
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;: This directive sets theX-Forwarded-Forheader in the proxy request to include the original client IP address as well as any intermediate proxy servers IP addresses. -
proxy_read_timeout 120s;: This directive sets the timeout for reading a response from the backend server to 120 seconds. If no response is received within this time, the proxy request will be terminated.
Overall, this configuration is used to proxy requests from the NGINX server to a backend server while preserving certain headers and setting timeout limits.
原文地址: https://www.cveoy.top/t/topic/psQ8 著作权归作者所有。请勿转载和采集!