In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Rewrite jump scenario URL looks more standardized and reasonable; companies will disguise dynamic URL addresses as static addresses to provide services; after the URL is replaced with a new domain name, the old access will be redirected to the new domain name; and some business adjustments will be made on the server. Rewrite Jump implementation
Rewrite practical scenario the implementation of Nginx jump requirements using rewrite for matching jump using if matching global variables after jump using location matching and then jumping rewrite on server {}, if {} Use if global variable matching for domain names or parameter strings in the location {} paragraph to match regular expression metacharacters commonly used by proxy_pass reverse agents ^ match the start position of the input string match the end position of the input string * match the previous character zero or more times + match the previous character one or more times? Matches the preceding character zero or once. Match any single character except\ n, using a pattern such as "[.\ n]" Can match any character including "\ n"\ d match pure number [0-9] {n} repeat {n,} repeat n or more times [c] match a single character c [a-z] match any [a-zA-Z] of the lowercase letter of Amurz] match any Rewrite command syntax of the lowercase letter of Amurz or the uppercase letter of Amurz: rewrite [flag] The flag tag supported by the regular jump content rewrite indicates that the tag last is equivalent to the [L] tag of Apache, indicating that the rewritebreak is equivalent to the [L] tag of Apache, indicating that the completion of the matching of this rule terminates, no longer matches any subsequent rules redirect returns 302 temporary redirection, the browser address will display the jumped URL address, and the crawler will not update the urlpermanent to return 301 permanent redirection. The browser address bar will display the jumped URL address, crawler update urllast and break compare lastbreak usage scenarios generally written in server and if generally use URL matching in location without stopping rewriting url matching after termination rewriting url matching location classification location = patt {} [exact matching] location patt {} [General matching] location ~ patt {} [regular matching] Common expression tags for regular matching ~ perform a regular match Case-sensitive ~ * performs a regular match, not case-sensitive! ~ performs a regular match, case-sensitive mismatch! ~ * performs a regular match, case-insensitive mismatch ^ ~ ordinary character matching Use prefix matching. If the match is successful, the exact match of other location= normal characters is no longer matched. That is, an exact match @ defines a named location, using the location priority when internally directed
For expressions of the same type, long characters will be matched first.
Arrange by priority
= type ^ ~ Type expression regular expression (~ and ~ *) Type regular string matching type, matching by prefix usually matches (/), if there is no other match, any request will match to compare rewrite and location
Identical point
Can realize the jump.
Differences
Rewrite is to change the path to get resources within the same domain name. Location is to control access or direction proxy for a class of paths, and you can also proxy_pass to other machines.
Rewrite will write in location execute rewrite instructions in server block execute location match execute rewrite instructions in selected location location priority example # # exact match /, hostname cannot be followed by any string location = / {[configuration A]} # # all addresses begin with /, this rule will match all requests However, regular and longest strings first match location / {[configuration B]} # # matches any address that begins with / documents/, and location / documents/ {[configuration C]} # # matches any address that begins with / documents/abc when the subsequent regular expression does not match, and when the subsequent regular expression does not match Location ~ / documents/abc {[configuration D]} # # addresses starting with / images/. After matching, stop matching location ^ ~ / images/ {[configuration E]} # # match all requests ending in gif, and images under / images/ will be processed by [configuration E] because ^ ~ has a higher priority location ~ *\. (gif | jpg | jpeg) ${[configuration F]} # # longest character matches to / images/abc Lowest priority location / images/abc {[configuration G]} # # priority location ~ / images/abc {[configuration H]} # # if compared with regular ~ / images/abc/1.html, regular priority is higher location / images/abc/1.html {[configuration I]} location priority rule
Match a specific file
(location = full path) > (location ^ ~ full path) > (location ~ * full path) > (location ~ full path) > (location full path) > (location /)
Use directory matching to access a file
(location= directory) > (location ^ ~ directory /) > (location~ directory) > (location~ * directory) > (location directory) > (location /)
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.