zoukankan      html  css  js  c++  java
  • nginx if多条件判断

    server {
        listen 10001;
        server_name  qwe.com asd.com;
        set $flag 0;
        if ($http_user_agent ~* "Chrome"){
            set $flag "${flag}1";
        }
        if ($host ~* qwe.com){
            set $flag "${flag}1";
        }
        if ($flag = "011"){
            rewrite ^.+ http://asd.com:10001/test2;
        }
        
        location ^~ /test1 {
            try_files $uri $uri/ /test1/index.html;
            root   html;
            index  index.html index.htm;
            autoindex off;
        }

        location ^~ /test2 {
            try_files $uri $uri/ /test2/index.html;
            root   html;
            index  index.html index.htm;
            autoindex off;
        }
            
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


  • 相关阅读:
    将n个不同的球放到m个相同的袋子里有多少种方案?

    平面分割直线2
    差分
    并查集(UnionFind)
    约瑟夫环公式
    Kruskal
    线性欧拉筛
    SPAF
    Dijkstra
  • 原文地址:https://www.cnblogs.com/lazy-sang/p/12394649.html
Copyright © 2011-2022 走看看