Location means "positioning", which is mainly based on Uri for different positioning. It is essential in the configuration of virtual hosts. Location can locate different parts of the website to different processing methods. 1. Basic syntax of location location [=|~|~*|^~] patt { } =: Strict match. If the query matches, the search stops and the request is processed immediately. ~: for case-sensitive matching (regular expressions can be used). ~*: for case-insensitive matching (regular expressions can be used). ^~: If you use this prefix with a regular string, it tells nginx not to test the regular expression if the path matches. 2. How location works 3. Simple examples prove the conclusions of the above pictures Matching process without regular expressions location = / { root /var/www/html/; index index.htm index.html; } location / { root /usr/local/nginx/html; index index.html index.htm; } The location configuration is as above. If you visit http://xxx.com/, the positioning process is: Matching process with regular expressions location / { root /usr/local/nginx/html; index index.html index.htm; } location ~ image { root /var/www/; index index.html; } If we visit http://xx.com/image/logo.png. At this time, the uri is "/image/logo.png", which matches the common match "/" and the regular match "~ image". However, according to the matching process analysis in the above picture, the regular match is finally effective. So the final access address is: /var/www/image/logo.png. If you want the final matching path to be /var/www/logo.png, you can change the "root /var/www/" in the regular expression to "alias /var/www/" The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: The difference and execution method of select count() and select count(1)
>>: Two ideas for implementing database horizontal segmentation
CSS Clear Default Styles The usual clear default ...
This article uses examples to illustrate the simp...
RGB color table color English name RGB 16 colors ...
1. First prepare the MySQL and Eclipse environmen...
There are three pages A, B, and C. Page A contains...
1.service command The service command actually go...
Table of contents I. Overview 2. pt-archiver main...
Table of contents Review of Object.defineProperty...
When href is needed to pass parameters, and the p...
Sometimes you need to use links, but you don't...
MySQL is a relational database management system ...
This article describes how to install MySQL 5.7 f...
lead Some common triangles on web pages can be dr...
Today I got familiar with the mouse zooming effect...
I solved a problem tonight that has been botherin...