1. 带有“=”前缀的指令与查询完全匹配。如果找到,搜索停止
2. 所有其余指令与传统的字符串。如果此匹配使用“^〜”前缀,则停止搜索
3. 正则表达式,按照它们在配置文件中定义的顺序
4. 如果#3产生匹配,则使用该结果。否则,使用来自#2的匹配
location = / {
# matches the query / only.
[ configuration A ]
}
location / {
# matches any query, since all queries begin with /, but regular
# expressions and any longer conventional blocks will be
# matched first.
[ configuration B ]
}
location /documents/ {
# matches any query beginning with /documents/ and continues searching,
# so regular expressions will be checked. This will be matched only if
# regular expressions don't find a match.
[ configuration C ]
}
location ^~ /images/ {
# matches any query beginning with /images/ and halts searching,
# so regular expressions will not be checked.
[ configuration D ]
}
location ~* \.(gif|jpg|jpeg)$ {
# matches any request ending in gif, jpg, or jpeg. However, all
# requests to the /images/ directory will be handled by
# Configuration D.
[ configuration E ]
}