nginx的location匹配逻辑(翻译自官网)
来源:互联网 发布:中国工商银行mac版 编辑:程序博客网 时间:2024/06/05 10:48
A regular expression is preceded with the tilde (~
) for case-sensitive matching, or the tilde-asterisk (~*
) for case-insensitive matching. The following example matches URIs that include the string .html or .htmin any position.
(以~开头的正则表达式是对大小写敏感的),~*是不关心大小写,下面的URIs匹配的html和html
location ~ \.html? { ...}
To find the location that best matches a URI, NGINX Plus first compares the URI to the locations with a prefix string. It then searches the locations with a regular expression.
为了匹配URI,NGINX首先匹配字符串前缀(prefix string),再匹配正则表达式Higher priority is given to regular expressions, unless the ^~
modifier is used. Among the prefix strings NGINX Plus selects the most specific one (that is, the longest and most complete string). The exact logic for selecting a location to process a request is given below:
如果不使用^~修饰符,正则表达式会有更高的优先级。在字符串前缀中,nginx会找到最匹配的那个(最长,最完整的).下面给出了完整的匹配逻辑。
- Test the URI against all prefix strings. (URI匹配所有的字符串前缀)
- The
=
(equals sign) modifier defines an exact match of the URI and a prefix string. If the exact match is found, the search stops.(=修饰符规定了一个精确的匹配,如果该匹配成功,到此结束) - If the
^~
(caret-tilde) modifier prepends the longest matching prefix string, the regular expressions are not checked.(如果^~修饰符预先加在最长匹配的字符串前缀那里,那么其他的正则表达式不会被使用) - Store the longest matching prefix string.(存储匹配最长的字符串前缀)
- Test the URI against regular expressions.(URI和正则表达式匹配)
- Break on the first matching regular expression and use the corresponding location.(第一个匹配的正则表达式那里终端,并且使用对应的那个location)
- If no regular expression matches, use the location corresponding to the stored prefix string.(如果没有正则表达式匹配,那么使用存储字符串前缀的那个location)
- nginx的location匹配逻辑(翻译自官网)
- nginx的location匹配
- 关于nginx的location匹配
- Nginx的location匹配问题
- Nginx 的 location 指令的匹配规则
- Nginx的location匹配规则和全局变量
- Nginx的location匹配规则(转载)
- nginx location的正则匹配规则
- nginx配置中location的匹配规则
- nginx location 匹配顺序
- nginx location匹配规则
- Nginx location 匹配规则
- nginx location匹配规则
- nginx location匹配规则
- nginx location匹配规则
- NGINX location 匹配规则
- nginx location匹配规则
- nginx location匹配规则
- POJ 2709 Painter
- jquery定位div中的滚动条
- ubuntu中desktop与alternate版本的区别
- mysql对比oracle
- goroutine
- nginx的location匹配逻辑(翻译自官网)
- Linux内核之/proc节点
- 在js中'与"的区别
- git实验之代码提交
- 关于 explicit 的一些学习
- 22. Generate Parentheses
- cocos studio的事件绑定 Click Touch Event
- React-Native学习指南
- Microsoft Visual Studio快捷键使用说明