There are several types of Nginx location:
1. prefix, can have = or ^~ modification, for example
Location//start of
location/img//img/the beginning of the
Location =/a.htm just/a.htm
Location ^~/d matches no longer checks for regular expression location
2. Regular expressions, fixed ~ or ~* (case-insensitive) start with, for example:
Location ~ \.html$
Location ~* \.gif$
When there are multiple location, the priority is as follows:
1.Test the URI against all prefix strings.
Compare with all prefixes
2.The = (equals sign) modifier defines an exact match of the URI and a prefix string. If The exact match is found, the search stops.
A match prefix has =, then the match is ended
3.If the ^~ (caret-tilde) modifier prepends the longest matching prefix string, the regular expressions is not checked.
Longest match with ^~ to end match
4.Store the longest matching prefix string.
Save longest match
5.Test the URI against regular expressions.
Re-check the regular expression at the beginning of the ~
6.Break on the first matching regular expression and use the corresponding location.
First matched regular expression, ending match
7.If no regular expression matches, use the location corresponding to the stored prefix string.
If there is no regular match, the longest prefix is used
The above describes the Nginx location priority in detail, including the location,nginx aspects of the content, I hope that the PHP tutorial interested in a friend helpful.