nginx Location正则表达式
1. Location正则表达式
1.1. location的作用
location指令的作用是根据用户请求的URI来执行不同的应用,也就是根据用户请求的网站URL进行匹配,匹配成功即进行相关的操作。
1.2. location的语法
=开头表示精确匹配
如 A 中只匹配根目录结尾的请求,后面不能带任何字符串。
^~ 开头表示uri以某个常规字符串开头,不是正则匹配
~ 开头表示区分大小写的正则匹配;
~* 开头表示不区分大小写的正则匹配
/ 通用匹配, 如果没有其它匹配,任何请求都会匹配到
Location语法可以参考:
https://www.cnblogs.com/coder-yoyo/p/6346595.html
1.3. 域名相同,拦截不同的项目名称
server {
listen 80;
server_name localhost;
#拦截uri以tomcat_8080开头
location ^~ /tomcat_8080/ {
proxy_pass http://127.0.0.1:8080/;
index index.html index.htm;
}
#拦截uri以tomcat_8081开头
location ^~ /tomcat_8081/ {
proxy_pass http://127.0.0.1:8081/;
index index.html index.htm;
}
}
nginx Location正则表达式的更多相关文章
- Nginx location 匹配顺序整理
Nginx location模块整理 具体的Nginx安装就不在这里描述了,这里只是为了对location的描述 Nginx环境 a. 查看当前系统cat /etc/redhat-release [r ...
- Nginx location配置详细解释
nginx location配置详细解释 语法规则: location [=|~|~*|^~] /uri/ { - } = 开头表示精确匹配 ^~ 开头表示uri以某个常规字符串开头,理解为匹配 ur ...
- nginx Location 语法基础知识
URL地址匹配是Nginx配置中最灵活的部分 Location 支持正则表达式匹配,也支持条件匹配,用户可以通过location指令实现Nginx对动丶静态网页的过滤处理. Nginx locatio ...
- nginx location 正则匹配
nginx 统计语句1.根据访问IP统计UV awk '{print $1}' access.log|sort | uniq -c |wc -l2.统计访问URL统计PV awk '{print $7 ...
- Nginx Rewrite正则表达式案例
前两天简单整理了下Nginx的URL Rewrite基本指令,今天谈谈Nginx Rewrite的location正则表达式. 1.Nginx Rewrite 基本标记(flags) last 相当于 ...
- [nginx]location语法
location语法 location语法格式 location [=|~|~*|^~] uri { .... } location [=|~|~*|^~] uri {....} 指令 匹配标识 匹配 ...
- nginx location正则写法
nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...
- nginx location正则写法(转载)
nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...
- Nginx location 配置用法及正则例子
Nginx location 配置语法 1. location [ = | ~ | ~* | ^~ ] uri { ... } 2. location @name { ... } ...
随机推荐
- TreeSet 比较器排序 自定义对象
package cn.itcast.day21.treeset2; import java.util.Comparator; import java.util.TreeSet; /* * TreeSe ...
- November 8th 2016 Week 46th Tuesday
When he can't, he tries a new way to share a new pair. 当他做不到时,他尝试一种新的方式:分享. To share, your failing e ...
- Django 错误之 No module named ‘MySQLdb’
由于卸载Mysql时将很多相关依赖包都卸载了,重装mysql后启动django出现如下错误: django.core.exceptions.ImproperlyConfigured:Error loa ...
- [T-ARA][Bye Bye]
歌词来源:http://music.163.com/#/song?id=22704472 사랑하는 그대 Bye Bye, Bye Bye, Bye Bye, [sa-lang-ha-neun geu ...
- 针对 Linux 环境下 gdb 动态调试获取的局部变量地址与直接运行程序时不一致问题的解决方案
基础的缓冲区溢出实践通常需要确定运行状态下程序中的某些局部变量的地址,如需要确定输入缓冲区的起始地址从而获得注入缓冲区中的机器指令的起始地址等.在 Linux 环境下,可通过 gdb 对程序进行动态调 ...
- Array.prototype.reduce 的理解与实现
Array.prototype.reduce 是 JavaScript 中比较实用的一个函数,但是很多人都没有使用过它,因为 reduce 能做的事情其实 forEach 或者 map 函数也能做,而 ...
- __autoreleasing 与 局部变量
__autoreleasing 修饰的变量不是局部变量: 它的生命周期由autoreleasepool负责: +(Reachability*)reachabilityWithHostname:(NSS ...
- 【CF449D】Jzzhu and Numbers
题目 提供一个非容斥做法--\(FWT\) 我们发现我们要求的东西就是一个背包,只不过是在\(and\)意义下的 自然有 \[dp_{i,j}=\sum_{k\&a_i=j}dp_{i-1,k ...
- SPOJ-SUBSET Balanced Cow Subsets
嘟嘟嘟spoj 嘟嘟嘟vjudge 嘟嘟嘟luogu 这个数据范围都能想到是折半搜索. 但具体怎么搜呢? 还得扣着方程模型来想:我们把题中的两个相等的集合分别叫做左边和右边,令序列前一半中放到左边的数 ...
- Linux - Confluence搭建
0. 摘要 Confluence自身携带内置数据库,对于生产环境建议搭建外置数据库,Confluence通过相应驱动连接上.并操作数据库.Confluence支持多种数据库,本文采用MySQL. 1. ...