zoukankan      html  css  js  c++  java
  • Nginx location 正则篇



    location 前缀


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


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


    ~                          正则匹配,区分大小写


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


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


    location匹配顺序

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

     
    location匹配路径

    alias路径在匹配后直接替换,root路径在匹配后追加到location匹配到的路径之后
  • 相关阅读:
    memento模式
    observe模式
    state模式
    Trie树的简单介绍和应用
    strategy模式
    全组和问题
    SRM 551 DIV2
    全排列问题
    TSE中关于分词的算法的改写最少切分
    template模式
  • 原文地址:https://www.cnblogs.com/gdufs/p/8643286.html
Copyright © 2011-2022 走看看