location expression type
Location priority description The order of locations in nginx's location and configuration does not matter much. The type of the location expression. For expressions of the same type, the one with a longer string will be matched first. Here are the instructions in order of priority:
The location priority example configuration items are as follows: location = / { # Only matches requests / [ configuration A ] } location / { # Matches all requests starting with /. But if there is a longer expression of the same type, the longer expression is chosen. If there is a regular expression that can be matched, # will match the regular expression first. [ configuration B ] } location /documents/ { # Matches all requests starting with /documents/. But if there is a longer expression of the same type, the longer expression is chosen. #If there is a regular expression that can be matched, the regular expression will be matched first. [ configuration C ] } location ^~ /images/ { # Match all expressions starting with /images/. If the match is successful, stop matching and searching. Therefore, even if there is a matching regular expression location, it will not be used [configuration D] } location ~* \.(gif|jpg|jpeg)$ { # Match all requests ending with gif jpg jpeg. However, requests starting with /images/ will use Configuration D [ configuration E ] } Request matching example / -> configuration A /index.html -> configuration B /documents/document.html -> configuration C /images/1.gif -> configuration D /documents/1.jpg -> configuration E Note that the above matching has nothing to do with the order in which they are defined in the configuration file. Summarize This is the end of this article about nginx location priority. For more information about nginx location priority, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Implementation process of row_number in MySQL
>>: How to use indexes to optimize MySQL ORDER BY statements
Table of contents 1. Comparison with Vue2 1. New ...
1. Flex is the abbreviation of Flexible Box, whic...
Table of contents Preface Setting up with Vue CLI...
{ {}} Get the value, the original content of the ...
01PARTCoreWebApi tutorial local demonstration env...
Brief review: Browser compatibility issues are of...
1. Spring boot does not support jsp jar package, ...
Introduction to Docker Docker is an open source c...
Table of contents Row-Column Conversion Analyze t...
1. In IE, if relative positioning is used, that is...
Table of contents Preface Lua Script nignx.conf c...
1. Meaning of partition table A partition table d...
I just learned mybatis today and did some simple ...
1. MyISAM storage engine shortcoming: No support ...
Written in front Environment: MySQL 5.7+, MySQL d...