When the client sends a http request, will be removed after receiving the header Nginx head host, matched with each server server_name nginx.conf in the order determined in the end of which a server to process the request block.
server_name match with host priority order:
location [=|~|~*|^~] /uri/ { … }
=
It represents the beginning of an exact match
^~
Uri represents the beginning of a string beginning with a conventional, understood as the path to match the url
~
It represents the case-sensitive regular match
~*
Indicate a case-insensitive regular match
!~
And !~*
are not case-sensitive and case-insensitive match does not match the regular
/
General match, any requests are matched.
If a matching rule to ^
begin with, is the beginning of the string matches the specified path, if no match is content in the url contains the specified string
If a matching rule to $
the end, is to match the specified string to the end of the path
A case where a plurality of matching location arranged order (time when there is a successful match, matching is stopped, according to the current processing request matching rule):
- Priority match
=
- Next match
^~
- Performed in order to match the file
- Last match
/