nginx灰度环境

 1 1、nginx.conf
 2     split_clients "${remote_addr}AAA" $request_type {
 3         25% "abtest";
 4         * "online";
 5     }
 6 2、mobile.vipkid.com.cn.conf
 7     if ($request_type = "abtest") {
 8         set $group _abtest;
 9     }
10                 proxy_pass http://mobile_vipkid_com_cn$group;
11 upstream mobile_vipkid_com_cn_abtest {
12         server 10.0.3.141:8080 weight=10 max_fails=3 fail_timeout=5s;
13         server 10.0.4.141:8080 weight=10 max_fails=3 fail_timeout=5s;
14    }
15 upstream mobile_vipkid_com_cn {
16         server 10.0.3.142:8080 weight=10 max_fails=3 fail_timeout=5s;
17         server 10.0.4.142:8080 weight=10 max_fails=3 fail_timeout=5s;
18    }
原文地址:https://www.cnblogs.com/weibiao/p/6273794.html