Syntax
location [=|~*|^~|@]/uri/{…}
Configuration block
server
Details
location will try to match the above uri expression based on the uri in the user request If it matches, the configuration in the lcoation block is selected to handle the user request. Of course, there are various matching methods.
= means an exact match
~means matching the URI is always case-sensitive
~* means ignore case when matching the URI
^~ means only the first half of the URI needs to be matched
@ means only the first half of the URI needs to be matched Redirection between requests within the Nginx service
Note
locations are sequential. If a request may be matched by multiple locations, the request will actually be processed by the first location.
Finally: location/{} will handle all requests.
The above introduces the location of nginx configuration, including the content of location and nginx. I hope it will be helpful to friends who are interested in PHP tutorials.