ロケーションディレクティブはどの順序で起動しますか?
ドキュメントの例:
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 ]
}
それでも混乱する場合は、 詳細な説明はこちら を参照してください。
この順序で起動します。
=
(exactly)
location = /path
^~
(前方一致)
location ^~ /path
~
(大文字と小文字を区別する正規表現)
location ~ /path/
~*
(大文字と小文字を区別しない正規表現)
location ~* .(jpg|png|bmp)
/
location /path