时间:2022-12-02 11:43:00 | 栏目:Nginx | 点击:次
前置测试访问域名:www.test.com/api/upload
location /api/ { proxy_pass http://127.0.0.1:8080/; }
访问地址:www.test.com/api/upload-->http://127.0.0.1:8080/upload
location /api { proxy_pass http://127.0.0.1:8080/; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080//upload
location /api/ { proxy_pass http://127.0.0.1:8080; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080/api/upload
location /api { proxy_pass http://127.0.0.1:8080; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080/api/upload
location /api/ { proxy_pass http://127.0.0.1:8080/server/; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080/server/upload
location /api { proxy_pass http://127.0.0.1:8080/server/; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080/server//upload
location /api/ { proxy_pass http://127.0.0.1:8080/server; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080/serverupload
location /api { proxy_pass http://127.0.0.1:8080/server; }
访问地址: www.test.com/api/upload-->http://127.0.0.1:8080/server/upload
1.proxy_pass代理地址端口后有目录(包括 / ),转发后地址:代理地址+访问URL目录部分去除location匹配目录
2.proxy_pass代理地址端口后无任何,转发后地址:代理地址+访问URL目录部