自学内容网 自学内容网

nginx proxy_pass 后有无/区别

 1.在nginx设置proxy_pass时,当在后面的url加上了/,nginx不会把location中匹配到的路径往后转递,而是扔掉(实际访问http://127.0.0.1:8080/xxx)

location /proxy/ {
  proxy_pass http://127.0.0.1:8080/
}

2.在nginx设置proxy_pass时,当在后面的url上未加/时,则会把匹配到的路径部分往后转递 (实际访问http://127.0.0.1:8080/proxy/xxx)

location /proxy/ {
  proxy_pass http://127.0.0.1:8080
}

注:强制要求/要么都加要么都不加


原文地址:https://blog.csdn.net/u013008898/article/details/135937871

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!