Nginx的location的用法
location可以用=号,也可以不加=号。
不加=号配置如下。是模糊匹配查询只要前三个字母是abc就行了。
1 2 3 4
| http://192.168.200.141/abc?p1=tom http://192.168.200.141/abc http://192.168.200.141/abcdsa 这些情况都可以访问
|
1 2 3 4 5 6 7 8 9 10 11
| server { listen 80; server_name localhost; location /abc { default_type text/plain; return 200 "access success~~"; } location = /50x.html { root html; } }
|

加=号的情况,必须按照=后面一模一样
1 2 3 4 5 6 7 8 9 10 11
| server { listen 80; server_name localhost; location =/abc { default_type text/plain; return 200 "access success~~"; } location = /50x.html { root html; } }
|
1 2
| http://192.168.200.141/abc 可以匹配 http://192.168.200.141/abc/ 不能访问
|

总结
在nginx,conf中location关键字后面加上=。浏览器输入的网址必须和=号后面的内容【包括斜杠】