nginx2

WBOY
Release: 2016-07-29 09:01:12
Original
827 people have browsed it

nginx.conf configuration location

location matching command
~ #The wavy line indicates performing a regular match, case-sensitive
~* # means performing a regular match, case-insensitive
^~ #^~ means normal character matching. If this option matches, only this option will be matched and other options will not be matched. It is generally used to match directories
= #Perform exact matching of common characters
@ #"@" defines a named location, used when directed internally, such as error_page, try_files

location matching priority (regardless of the order of location in the configuration file)
= Exact matches will be processed first. If an exact match is found, nginx stops searching for other matches.
Ordinary character matching, regular expression rules and long block rules will be prioritized and matched against the query. That is to say, if the item matches, you need to check whether there is a regular expression match or a longer match.
^~ will only match this rule, and nginx will stop searching for other matches, otherwise nginx will continue to process other location instructions.
The final matching method contains instructions with "~" and "~*". If a corresponding match is found, nginx stops searching for other matches; when there is no regular expression or no regular expression is matched, then the one with the highest degree of matching Verbatim matching directives will be used.

<code>location  = / {
  <span># </span>只匹配<span>"/"</span>.
  [ configuration A ] 
}
location  / {
  <span># </span>匹配任何请求,因为所有请求都是以<span>"/"</span>开始
  <span># </span>但是更长字符匹配或者正则表达式匹配会优先匹配
  [ configuration B ] 
}
location ^~ /images/ {
  <span># </span>匹配任何以 /images/ 开始的请求,并停止匹配 其它location
  [ configuration C ] 
}
location ~* .(gif|jpg|jpeg)$ {
  <span># </span>匹配以 gif, jpg, or jpeg结尾的请求. 
  <span># </span>但是所有 /images/ 目录的请求将由 [Configuration C]处理.   
  [ configuration D ] 
}</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced nginx 2, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!