

nginx的location匹配规则和顺序
source link: https://www.wencst.com/archives/1949
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

nginx的location匹配规则和顺序
精准匹配>模糊匹配
匹配多的>匹配少的
(location =) > (location 完整路径) > (location ^~ 路径) > (location ~,~* 正则顺序) > (location 部分起始路径) > (/)
location = /uri =开头表示精确匹配,只有完全匹配上才能生效。
location ^~ /uri ^~ 开头对URL路径进行前缀匹配,并且在正则之前。
location ~ pattern ~开头表示区分大小写的正则匹配。
location ~* pattern ~*开头表示不区分大小写的正则匹配。
location /uri 不带任何修饰符,也表示前缀匹配,但是在正则匹配之后,如果没有正则命中,命中最长的规则。
location / 通用匹配,任何未匹配到其它location的请求都会匹配到,相当于switch中的default。
如果文章对您有用,扫一下支付宝的红包,不胜感激!
欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)
Leave a Reply Cancel reply
You must be logged in to post a comment.
Recommend
-
67
nginx之location的匹配规则
-
46
-
56
由于团队在进行前后端分离,前端接管了 Nginx 和 node 层,在日常的工作中,跟 Nginx 打交道的时候挺多的。其中 location 是使用最多和改动最多的地方。之前对 location 的匹配规则是一知半解的。为了搞明白 location 是如何匹
-
65
Nginx 的 location 实现了对请求的细分处理,有些 URI 返回静态内容,有些分发到后端服务器等,今天来彻底弄懂它的匹配规则 一个最简单的 location 的例子如下 server { server_name website.com;
-
11
WEB应用Apache/Nginx伪静态规则匹配http://出现的问题与解决Jager · 3月3日 · 2015年nginx配...
-
3
MySQL帐号命名规范 中英双语对照版请查看: GitHub中英对照版: MySQL帐号命名规范 MyS...
-
6
Nginx中的location匹配与rewrite重写跳转 推荐 原创 官方认证. 2022-03-16 18:00:01...
-
6
Nginx 的 location 匹配更新日期: 2022-04-16阅读量: 9标签: nginx分享扫一扫分享
-
9
本章介绍更多的规则匹配条件。 注意 本系列文章测试环境为 centos 7,iptables 版本 1.4.21。 源IP地址 指定多个IP地址
-
29
Iptables防火墙tcp-flags模块扩展匹配规则 tcp-flags模块的作用是判断TCP协议数据报文标志位的返回值的,在TCP的三次握手中,第一次握手客户端向服务器发送syn=1的数据报文,第二次握手服务端向客户端发送sync和ack=1的报文,第三次握手客户端向服...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK