为什么nginx的location是如何匹配的?
苦逼码农 2016-11-17 10:58:02 server {
listen 80;
server_name www.sina.com.cn;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://www.sina.com.cn;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
假设真实存在http://www.sina.com.cn/121.html 这个资源,那么nginx是如何匹配到第一个location的,
第一个location是/啊, nginx看到/121.html时候,会以最大前缀长度匹配,下面的我就不懂了。