前置測試存取網域: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
以上是nginx location和proxy_pass的差別是什麼的詳細內容。更多資訊請關注PHP中文網其他相關文章!