Nginx的location匹配规则解析

情况1:

proxy_pass  http://IPaddr/    #删除匹配段,一般配置接口使用

访问 http://域名/abc/test.map 分下面两种情况
1)location /abc/
会转发到 http://IPaddr/test.map
2) location /abc
会转发成 http://IPaddr//test.map —————-linux //路径=/路径
所以也等价于 http://IPaddr/test.map 的访问

情况2:

proxy_pass  http://IPaddr    #匹配段和此地址段拼接

这个也分两种情况
1) location /abc
这种可以匹配 /abc 和 /abc/
2)location /abc/
这种只能匹配 /abc/ 匹配目录

Leave a Reply

Your email address will not be published. Required fields are marked *