: This article describes the problems found during Nginx deployment. For more information about PHP tutorials, see. 1. during SSH project development, no action is configured when nginx configures the service. nginx does not forward the action request.
It turns out to be as follows:
# JSP is directly processed by tomcat, because nginx is not a servlet container and cannot process JSPlocation ~ . * \. (Jsp | do) $ {proxy_pass http: // mysvr; # The following are some reverse proxy configurations that can be deleted. proxy_redirect off; # backendWeb serverYou can obtain the Real IPproxy_set_header Host $ host: 9999; proxy_set_header X-Real-IP $ remote_addr through X-Forwarded-For $ proxy_add_x_forwarded_for ;}
To:
# JSP is directly processed by tomcat, because nginx is not a servlet container and cannot process JSPlocation ~ . * \. (Jsp | do | action) $ {proxy_pass http: // mysvr; # The following are some reverse proxy configurations that can be deleted. proxy_redirect off; # backendWeb serverYou can obtain the Real IPproxy_set_header Host $ host: 9999; proxy_set_header X-Real-IP $ remote_addr through X-Forwarded-For $ proxy_add_x_forwarded_for ;}
2. when nginx is modified not to listen on port 80 (default), for example, to Port 9999, the backend obtains port 80 or port 80, this is the port that nginx needs to add when setting the real IP address and port.
It turns out to be as follows:
# JSP is directly processed by tomcat, because nginx is not a servlet container and cannot process JSPlocation ~ . * \. (Jsp | do | action) $ {proxy_pass http: // mysvr; # The following are some reverse proxy configurations that can be deleted. proxy_redirect off; # backendWeb serverYou can obtain the Real IPproxy_set_header Host $ host through X-Forwarded-For; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for ;}
The modification is as follows:
# JSP is directly processed by tomcat, because nginx is not a servlet container and cannot process JSPlocation ~ . * \. (Jsp | do | action) $ {proxy_pass http: // mysvr; # The following are some reverse proxy configurations that can be deleted. proxy_redirect off; # backendWeb serverYou can obtain the Real IPproxy_set_header Host $ host: 9999; proxy_set_header X-Real-IP $ remote_addr through X-Forwarded-For $ proxy_add_x_forwarded_for ;}
The above describes the problems found during Nginx deployment, including Web server content, and hope to be helpful to friends who are interested in PHP tutorials.