nginx 地址重写,反向代理
测试nginx.conf文件中的proxy_pass,rewrite功能
nginx端口:99
server 端口:90
server 接口:/test
request url: localhost:99/iot/test
| nginx conf | ||||
|---|---|---|---|---|
| location | proxy_pass | rewrite | proxy server | proxy uri |
| /iot/ | http://172.31.62.57:90/; | http://172.31.62.57:90 | /test | |
| /iot/ | http://172.31.62.57:90; | http://172.31.62.57:90 | /iot/test | |
| /iot | http://172.31.62.57:90; | http://172.31.62.57:90 | /iot/test | |
| /iot | http://172.31.62.57:90/; | http://172.31.62.57:90 | //test | |
| /iot | http://172.31.62.57:90/; | “^/iot/(.*)$” /$1 break; | http://172.31.62.57:90 | /test |
| /iot | http://172.31.62.57:90/; | “^/iot/(.*)$” /$1 break; | http://172.31.62.57:90 | /test |
| /iot/ | http://172.31.62.57:90; | “^/iot/(.*)$” /$1 break; | http://172.31.62.57:90 | /test |
| /iot/ | http://172.31.62.57:90/; | “^/iot/(.*)$” /$1 break; | http://172.31.62.57:90 | /test |
参考链接:
https://blog.csdn.net/m0_64210833/article/details/130481374