码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx配置proxy_pass转发的/路径问题

时间:2018-06-23 10:35:49      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:配置   部分   index   htm   html   匹配   没有   ref   href   

在nginx中配置proxy_pass时,如果是按照^~匹配路径时,要注意proxy_pass后的url最后的/,当加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走。

例如访问http://guuyoog.com/a/index.html

location ^~ /a/ 

proxy_pass http://test.com/
}

-->  http://test.com/index.html

 

location ^~ /a/ 

proxy_pass http://test.com
}

-->  http://test.com/a/index.html

Nginx配置proxy_pass转发的/路径问题

标签:配置   部分   index   htm   html   匹配   没有   ref   href   

原文地址:https://www.cnblogs.com/guuyoog/p/9216451.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!