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 ...
随机推荐
- html标签<td><tr><th>全称及缩写说明
<td> 是table data cell 的缩写,单元格 <tr> 是table row 的缩写,表格中的一行 <th> 是table header cell 的 ...
- python中常用内置函数用法总结
强制类型转换:int()float()str()list()tuple()set()dict()总结,这几种类型转换函数得用法基本一致,基本就是int(要转换得数据).返回值类型为对应得数据类型 ...
- Mac os下设置国内镜像加速站
无法忍受国外pip 仓库的龟速地址,安利一波国内高速镜像地址... 首推阿里云 repository 马爸爸 I ❤ u $ vim ~/.pip/pip.conf 在config中做如下配置: [ ...
- html常用代码
<marquee width="70%" scrollamount="2">大家好</marquee> // 大家好 字符从左到右 ...
- 同时连接gitlab和github
---恢复内容开始--- 原文地址:https://juejin.im/post/5ac0cf356fb9a028df22c246 1. 分别生成gitlab和github的ssh key 生成第一个 ...
- 如何保存android app日志
android 手机日志保存方法如下: 前置条件:已安装adb 1,手机usb连接电脑,打开USB调试模式(注意仅连接一台手机设备) 2,win+R输入cmd打开命令窗口,输入指令:adb devic ...
- 网络命令-nc(二)
继续Netcat 这个命令吧 1:远程拷贝文件 在本地输出 文件debian.img 到 192.168.5.40 主机12345端口监听 nc -v 192.168.5.40 12345 < ...
- Infinity、-Infinity和NaN
首先看看这三个代表什么: Infinity:正无穷大 -Infinity:负无穷大 NaN:Not a Number 当float或double类型的数除零时, 当被除数为非零值时,结果为无穷大 当被 ...
- vue 中router.go;router.push和router.replace的区别
vue 中router.go:router.push和router.replace的区别:https://blog.csdn.net/div_ma/article/details/79467165 t ...
- 插件化框架解读之四大组件调用原理-Activity(三)上篇
阿里P7移动互联网架构师进阶视频(每日更新中)免费学习请点击:https://space.bilibili.com/474380680 本文通过Activity调用原理来解读Replugin插件化技术 ...