location匹配命令
~ #波浪線表示執行一個正則匹配,區分大小寫
~* #表示執行一個正則匹配,不區分大小寫
^~ #^~表示普通字符匹配,如果該選項匹配,只匹配該選項,不匹配別的選項,一般用來匹配目錄
= #進行普通字符精確匹配
@ #"@" 定義一個命名的 location,使用在內部定向時,例如 error_page, try_files
location 優先級官方文檔
Directives with the = prefix that match the query exactly. If found, searching stops.
All remaining directives with conventional strings, longest match first. If this match used the ^~ prefix, searching stops.
Regular expressions, in order of definition in the configuration file.
If #3 yielded a match, that result is used. Else the match from #2 is used.
=前綴的指令嚴格匹配這個查詢。如果找到,停止搜索。
所有剩下的常規字符串,最長的匹配。如果這個匹配使用^前綴,搜索停止。
正則表達式,在配置文件中定義的順序。
如果第3條規則產生匹配的話,結果被使用。否則,如同從第2條規則被使用。
轉載: http://www.nginx.cn/115.html