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
If someone asked you whether running EXPLAIN on a...
Using UNION Most SQL queries consist of a single ...
<br />Related articles: 9 practical tips for...
Table of contents 1. Overview of the page 2. Infi...
Introducing vue and vue-router <script src=&qu...
Purpose of using Nginx Using Alibaba Cloud ECS cl...
Problem Description MySQL is started successfully...
This article uses an example to illustrate the us...
MySQL Limit can query database data in segments a...
Table of contents 1. What is Docker Compose and h...
Since myeclipse2017 and idea2017 are installed on...
Today I will share with you how to write a player...
Why is the title of the article “Imitation Magnif...
Method 1: Use the SET PASSWORD command First log ...
1. Modify my.cnf #The overall effect is that both...