1. proxy_pass斜杠或斜杠后缀结尾不带location
- proxy_pass 后无"/"或 "/xx" 则蕴含location中的原串;
- proxy_pass 后没有任何url门路信息(比方 "/", "/xx")则反向代理地址会蕴含location局部;否则,只会拼接匹配后的残余门路。
location /online/wxapi/proxy_pass http://localhost:8080/
拜访 "http://www.x.com/online/wxapi/a.html" 会拜访:
http://localhost:8080/a.html
location /online/wxapi/proxy_pass http://localhost:8080
拜访 "http://www.x.com/online/wxapi/xx.html" 会拜访
http://localhost:8080/online/...
2.总结:
- 你加"/" 拜访时就不加location;
- 你不加"/"拜访时它给你加location;