1. Proxy_pass Configuration Instructions
Do not take/
Copy Code code as follows:
location/test/
{
Proxy_pass http://t6:8300;
}
With
Copy Code code as follows:
location/test/
{
Proxy_pass http://t6:8300/;
}
The above two configurations, the difference is only proxy_pass forwarded by the path after the "/"
For Case 1, if the access URL = http://server/test/test.jsp, then after the Nginx agent, the request path will ask http://proxy_pass/test/test.jsp, test/as the root path, request test /Path of resources
For Case 2, if the access URL = http://server/test/test.jsp, the request path becomes http://proxy_pass/test.jsp after the proxy is nginx, directly accessing the server's root resource
2. Typical examples
Access different applications and resources under the same domain, depending on the root path
For example: a applies http://server/a; b Application Http://server/b
A application and B application together access domain name http://server;
When configuring Nginx agent forwarding, if the configuration of Scenario 2 is used, it can cause access to http://server/a/test.jsp when the agent to http://proxy_pass/ test.jsp, causing no access to the correct resources, the page if there is access to the root resources, will also be http://server as the root path to access resources, resulting in resource failure
In view of this kind of situation, need to use the situation 1, respectively for no application, set different root resource path, and ensure that the root path after the agent is still valid