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 is http://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 the Upgrade header in the proxy request to the value of the Upgrade header in the original client request.

  • proxy_set_header Connection $connection_upgrade;: This directive sets the Connection header in the proxy request to the value of the Connection header in the original client request.

  • proxy_set_header Host $host;: This directive sets the Host header in the proxy request to the value of the $host variable, which represents the hostname of the server.

  • proxy_set_header X-Real-IP $remote_addr;: This directive sets the X-Real-IP header in the proxy request to the IP address of the client making the request.

  • proxy_set_header REMOTE-HOST $remote_addr;: This directive sets the REMOTE-HOST header 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 the X-Forwarded-For header 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.

NGINX Proxy Configuration: Pass Requests to Backend Server

原文地址: https://www.cveoy.top/t/topic/psQ8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录