zoukankan      html  css  js  c++  java
  • 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/1.gif” request will match configuration D, and the “/documents/1.jpg” request will match configuration E.
    
    注意:
          优化等及相对于相同的匹配
  • 相关阅读:
    四则运算————javaweb版
    构建之法阅读笔记02
    十一周学习进度条
    软工概论-课堂练习:添加信息
    梦断代码阅读笔记01
    链接doc命令行的mysql的编码问题
    构建之法阅读笔记01
    第十周学习进度条
    web
    sql初——基础
  • 原文地址:https://www.cnblogs.com/hanxiaohui/p/8488584.html
Copyright © 2011-2022 走看看