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 { ... } ...
随机推荐
- 单纯形算法 matlab
%单纯形 %目标函数标准化 % min x1-3x2+2x3 %输入参量 N=[3 -1 2;-2 4 0;-4 3 8]; B=eye(3); A=[N B]; cn=[1;-3;2]; cb=ze ...
- #003 React 组件 继承 自定义的组件
主题:React组件 继承 自定义的 组件 一.需求说明 情况说明: 有A,B,C,D 四个组件,里面都有一些公用的逻辑,比如 设置数据,获取数据,有某些公用的的属性,不想在 每一个 组件里面写这些属 ...
- Spring 读取配置文件的俩种方式
读取配置可通过 org.springframework.core.env.Environment 类来获取, 也可以通过@Value的方式来获取 注解形式: @PropertySource({&quo ...
- SOJ1022 Uniform Generator
Computer simulations often require random numbers. One way to generate pseudo-random numbers is via ...
- 1898: [Zjoi2005]Swamp 沼泽鳄鱼
1898: [Zjoi2005]Swamp 沼泽鳄鱼 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 1582 Solved: 870 [Submit][S ...
- 你不知道的css高级应用三种方法——实现多行省略
前言 这是个老掉牙的需求啦,不过仍然有很多人在网上找解决方案,特别是搜索结果排名靠前的那些,都是些只会介绍兼容性不好的使用-webkit-line-clamp的方案. 如果你看到这篇文章,可能代表你正 ...
- POJ 1321 棋盘问题(非常经典的dfs,入门题)
棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 66277 Accepted: 31639 Descriptio ...
- w10下Oracle 11g完全干净卸载
1.关闭oracle所有的服务.可以在windows的服务管理器中关闭: 2.打开注册表:regedit 打开路径: <找注册表 :开始->运行->regedit> H ...
- CentOS 安装第三方yum源
yum install wget #安装下载工具 wget http://www.atomicorp.com/installers/atomic #下载 sh ./atomic #安装 yum che ...
- Java开发工程师基础Math,Random,Scanner类的使用
Math类的使用(重点) (1)数学操作类:该类没有构造函数,方法均为静态的 (2)掌握内容 A:成员变量 **E:比任何其他值都更接近e(即自然对数的底数)的double值. **PI:比任何其他值 ...