In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to use Location in Nginx, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Location expression type
~ means to perform a regular match that is case sensitive
~ * means to perform a regular match, which is case-insensitive
^ ~ indicates a normal character match. Use prefix matching. If the match is successful, no other location will be matched
= exact matching of ordinary characters. That is, it is a perfect match.
Location priority
The order of location in the location and configuration of nginx does not have much to do with the type of location expression. For expressions of the same type, long strings will match first.
Here are the instructions in order of priority:
The equal sign type (=) has the highest priority. Once the match is successful, no other matches are found.
^ ~ type expression. Once the match is successful, no other matches are found.
The regular expression type (~ *) takes second priority. If the regularities of multiple location can match, the one with the longest regular expression is used.
Regular string matching type. Match by prefix.
Example
The configuration items are as follows:
Location = / {# only match requests / [configuration A]} location / {# match all requests that start with /. # but if there is a longer expression of the same type, choose a longer expression. # if there is a regular expression to match, then match the regular expression first. [configuration B]} location / documents/ {# matches all requests that start with / documents/. # but if there is a longer expression of the same type, choose a longer expression. # if there is a regular expression to match, then match the regular expression first. [configuration C]} location ^ ~ / images/ {# matches all expressions that begin with / images/, and if the match succeeds, stops the match search. # so, even if there is a matching regular expression location, it will not be used [configuration D]} location ~ *\. (gif | jpg | jpeg) ${# matches all requests ending in gif jpg jpeg. # but requests that start with / images/ will use Configuration D [configuration E]}
Example of request matching:
/-> configuration A/index.html-> configuration B/documents/document.html-> configuration C/images/1.gif-> configuration D/documents/1.jpg-> configuration E is here about how to use Location in Nginx. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.