美文网首页
nginx根据ip判断返回不同的字符串

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

作者: 大龄程序员在帝都 | 来源:发表于2017-03-02 19:32 被阅读67次
 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判断返回不同的字符串

      本文链接:https://www.haomeiwen.com/subject/vaukgttx.html