nginx根据ip判断返回不同的字符串

 if ($server_addr ~* "172.16.10.167") {
        set $flag d;
         }
        if ($uri ~ ^/location.html$) {
        set $flag "${flag}x";
        }
        if ($flag = dx) {
        rewrite ^ https://xxxxx/dx-location.html permanent;
        }

        if ($server_addr ~* "172.16.10.166") {
        set $flag l;
         }
        if ($uri ~ ^/location.html$) {
        set $flag "${flag}t";
        }
        if ($flag = lt) {
        rewrite ^ https://xxxxlt-location.html permanent;
        }

你可能感兴趣的:(nginx根据ip判断返回不同的字符串)