location优先级
- location优先级
location优先级
location /img # 直接匹配
location /img {
index index.html
}
location = /img # 精确匹配
location = /img {
index index.html
}
location ^~ /img # 前缀匹配
location ^~ /img/ {
index index.html
}
location ~ /img #区分大小写
location ~* /img #不区分大小写
location ~* \.(gif|jpg|jpeg)$ {
index index.html
}
Let’s illustrate the above by an example: location = / {
[ configuration A ]
} location / {
[ configuration B ]
} location /documents/ {
[ configuration C ]
} location ^~ /images/ {
[ configuration D ]
} location ~* \.(gif|jpg|jpeg)$ {
[ configuration E ]
}
= 高于 ^~ 高于 ~ 高于 ~* The “/” request will match configuration A, the “/index.html” request will match configuration B, the “/documents/document.html” request will match configuration C, the “/images/.gif” request will match configuration D, and the “/documents/.jpg” request will match configuration E. 注意:
优化等及相对于相同的匹配
location优先级的更多相关文章
- nginx——location 优先级
一. location 的匹配符1.等于匹配符:=等于匹配符就是等号,特点可以概括为两点:精确匹配不支持正则表达式2.空匹配符空匹配符的特点是:匹配以指定模式开始的 URI不支持正则表达式3.正则匹配 ...
- nginx的location优先级
在nginx配置文件中,location主要有这几种形式: 1. 正则匹配 location ~ /abc { } 2. 不区分大小写的正则匹配 location ~* /abc { } 3. 匹配路 ...
- nginx location优先级
目录 1. 配置语法 2. 配置实例 3. 总结: 网上查了下location的优先级规则,但是很多资料都说的模棱两可,自己动手实地配置了下,下面总结如下. 1. 配置语法 1> 精确匹配 lo ...
- location 优先级
###我只是个搬运工 规则 等号类型(=)的优先级最高.一旦匹配成功,则不再查找其他匹配项 前缀普通匹配(^~)优先级次之.不支持正则表达式.使用前缀匹配,如果有多个location匹配的话,则使用表 ...
- nginx location 优先级
location 顺序/优先级: location = > location 完整路径 > location ^~ 路径 > location ~,~* 正则顺序 > ...
- nginx location在配置中的优先级
location表达式类型 ~ 表示执行一个正则匹配,区分大小写~* 表示执行一个正则匹配,不区分大小写^~ 表示普通字符匹配.使用前缀匹配.如果匹配成功,则不再匹配其他location.= 进行普通 ...
- NGINX location 在配置中的优先级
location表达式类型 ~ 表示执行一个正则匹配,区分大小写 ~* 表示执行一个正则匹配,不区分大小写 ^~ 表示普通字符匹配.使用前缀匹配.如果匹配成功,则不再匹配其他location. = 进 ...
- 转:Nginx配置指令location匹配符优先级和安全问题
转:http://www.jb51.net/article/47761.htm 使用nginx 很久了,它的性能高,稳定性表现也很好,得到了很多人的认可.特别是它的配置,有点像写程序一样,每行命令结尾 ...
- Nginx 配置指令location 匹配符优先级和安全问题【转】
Nginx配置指令location匹配符优先级和安全问题 使用nginx 很久了,它的性能高,稳定性表现也很好,得到了很多人的认可.特别是它的配置,有点像写程序一样,每行命令结尾一个";&q ...
随机推荐
- Delphi TextFile读取文本文件
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- BZOJ 3294: [Cqoi2011]放棋子(计数dp)
传送门 解题思路 设\(f[i][j][k]\)表示前\(k\)个颜色的棋子占领了\(i\)行\(j\)列的方案数,那么转移时可以枚举上一个颜色时占领的位置,\(f[i][j][k]=\sum\lim ...
- AcWing 260. 买票 (树状数组+二分)打卡
题目:https://www.acwing.com/problem/content/description/262/ 题意:给定一个队伍,每个人过来的时候可以插队,每个人会输入一个插入到哪个位置,但是 ...
- linux设备驱动第一篇:设备驱动程序简介
首先,我们知道驱动是内核的一部分,那么驱动在内核中到底扮演了什么角色呢? 设备驱动程序在内核中的角色:他们是一个个独立的“黑盒子”,使某个特定的硬件响应一个定义良好的内部编程接口,这些接口完全隐藏了设 ...
- hbase centos7 安装体验
1. 准备需要jdk1.8,hbase安装文件.大家可以官网下载. 解压文件,复制到指定目录 tar -zxvf jdk-8u201-linux-x64.tar.gz tar -zxvf hbas ...
- python3+django2 个人简单博客实现 -正在施工
- android ndk 编译 libevent
1. 下载 libevent 2.1.8 版本 https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/ ...
- 蛋糕仙人的javascript笔记
蛋糕仙人的javascript笔记:https://www.w3cschool.cn/kesyi/kesyi-nqej24rv.html
- UVALive 4728 Squares(旋转卡壳)
Squares The famous Korean IT company plans to make a digital map of the Earth with help of wireless ...
- 如何使用 VLD 检测程序中的内存泄漏?
下载地址:https://kinddragon.github.io/vld/ 下载 windows 安装包,进行安装即可,它会给你设置好 vs 的环境变量,使用时,直接在 vs ide 中包含即可. ...