Preface The location in the server block in the Nginx configuration is used to match the request URI so that different URIs can be processed differently. location type and conditions for successful matching
The summary can be divided into three categories: exact matching, ordinary matching and regular matching. Matching logic and priority For a request entering Nginx, its URI may meet the matching conditions of multiple locations, but the request will ultimately be processed by only one location logic (redirection is not counted), so there must be a priority difference when matching. Nginx's matching logic is as follows: 1. Perform an exact match If the request URI matches location = (meets the exact match condition), the content of the location is executed and no other matches are performed. Otherwise, see the next item. 2. Perform normal matching Next, Nginx will compare the URI with all the normal matching locations (regardless of ^~ type or unsigned type), and then find the location with the highest matching degree. If the location is of ^~ type, it will stop matching and execute the content of the location. If the location with the highest matching degree is of unsigned type, it will keep this unsigned location and continue with the following regular matching. If the URI does not meet the conditions of any normal matching location, it will go directly to the next step. 3. Perform regular expression matching The matching of regular expressions is related to the order of location. Nginx will match from top to bottom. If a location is matched, the logic of that location will be executed, and all subsequent regular expression locations will be ignored, terminating the matching. If no regular expression is matched, the previously reserved unsigned location will be executed. If no location was reserved before, 404 will be returned directly. Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: How to implement two-way binding function in vue.js with pure JS
>>: Explanation of the usage of replace and replace into in MySQL
Sprites: In the past, each image resource was an ...
Table of contents environment Virtual Machine Ver...
1. The startup menu is to move the cursor to the ...
When we install and configure the server LNPM env...
Although Microsoft provides T4 templates, I find ...
Here are two ways to install MySQL under Linux: y...
Problem Description When filter attribute is used...
Table of contents Review of Object.defineProperty...
Table of contents Preface 1. insert ignore into 2...
Table of contents Install Basic configuration of ...
Table of contents 1. Realistic Background 2. Agre...
The database installation tutorial of MySQL-8.0.2...
Preface Recently, during an interview, I was aske...
Table of contents Row-Column Conversion Analyze t...
Table of contents 1. Understanding Queues 2. Enca...