location 前缀


没有前缀               匹配以指定模式开头的location


=                          精准匹配,不是以指定模式开头


~                          正则匹配,区分大小写


~*                         正则匹配,不区分大小写


^~                         非正则匹配,匹配以指定模式开头的location


location匹配顺序

  • 多个正则location直接按书写顺序匹配,成功后就不会继续往后面匹配
  • 普通(非正则)location会一直往下,直到找到匹配度最高的(最大前缀匹配)
  • 当普通location与正则location同时存在,如果正则匹配成功,则不会再执行普通匹配
  • 所有类型location存在时,“=”匹配  >  “^~”匹配  >  正则匹配  >  普通(最大前缀匹配)

location匹配路径

alias路径在匹配后直接替换,root路径在匹配后追加到location匹配到的路径之后

Nginx location 正则篇的更多相关文章

  1. nginx location正则写法

    nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...

  2. nginx location正则写法(转载)

    nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...

  3. nginx location正则

    nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...

  4. nginx location 正则匹配

    nginx 统计语句1.根据访问IP统计UV awk '{print $1}' access.log|sort | uniq -c |wc -l2.统计访问URL统计PV awk '{print $7 ...

  5. 【转】Nginx location写法

    转自:https://www.cnblogs.com/IPYQ/p/7889399.html nginx location正则写法 location = / { # 精确匹配 / ,主机名后面不能带任 ...

  6. Nginx location 配置用法及正则例子

    Nginx location 配置语法     1. location [ = | ~ | ~* | ^~ ] uri { ... }     2. location @name { ... }   ...

  7. nginx location 知识知多少

    写在之前 众所周知 nginx location 路由转发规则多种多样,尤其是 [ = | ~ | ~* | ^~ ] 这些前缀是什么意思.root 与 alias 是否可以区分开,nginx 作为反 ...

  8. Nginx location 匹配顺序整理

    Nginx location模块整理 具体的Nginx安装就不在这里描述了,这里只是为了对location的描述 Nginx环境 a. 查看当前系统cat /etc/redhat-release [r ...

  9. Nginx Location配置总结

    Nginx Location配置总结 语法规则: location [=|~|~*|^~] /uri/ { - }= 开头表示精确匹配^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即 ...

随机推荐

  1. python和anacoda安装第三方库的位置

    查看已安装库及版本号,命令行pip list 安装第三方库位置:

  2. 在Linux上安装ant环境

    原文链接:http://www.cnblogs.com/sell/archive/2013/07/24/3210198.html 1.从http://ant.apache.org 上下载tar.gz版 ...

  3. IO复用,AIO,BIO,NIO,同步,异步,阻塞和非阻塞 区别参考

    参考https://www.cnblogs.com/aspirant/p/6877350.html?utm_source=itdadao&utm_medium=referral IO复用,AI ...

  4. T66597 小xzy的任务 题解

    T66597 小xzy的任务 题目背景 今天,小xzy的班主任交给他一个严肃的任务,匹配羽毛球运动员! ! ! 题目描述 羽毛球队有男女运动员各n人.给定2个n×n矩阵P和Q.Pij​是男运动员i和女 ...

  5. 使用Spring表达式语言进行装备--SpEL

    本文主要想记录最近的两个使用spring框架实现通过配置文件装备Bean,以及使用SpEL装备Bean. 1.使用配置文件装备Bean: 当我们写某些Bean的时候是希望这个Bean当中的属性是可以通 ...

  6. python之常用模块二(hashlib logging configparser)

    摘要:hashlib ***** logging ***** configparser * 一.hashlib模块 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 摘要算法 ...

  7. Java自定义异常类以及异常拦截器

    自定义异常类不难,但下面这个方法,它的核心是异常拦截器类. 就算是在分布式系统间进行传递也可以,只要最顶层的服务有这个异常拦截器类(下例是在 springboot 项目中) 1.自定义异常类,继承自 ...

  8. SignarL服务器端发送消息给客户端的几种情况

    一.所有连接的客户端 Clients.All.addContosoChatMessageToPage(name, message); 二.只发送给呼叫的客户端(即触发者) Clients.Caller ...

  9. java.io包下适配和装饰模式的使用

    如java.io.LineNumberInputStream(deprecated),是装饰模式(decorate)的实现: 如java.io.OutputStreamWriter,是适配器模式(ad ...

  10. python中的三元运算

    一.三元运算符 三元运算符就是在赋值变量的时候,可以直接加判断,然后赋值 格式:[on_true] if [expression] else [on_false] res = 值1 if 条件 els ...