http {
split-clients "${remote-addr}AAA" $variant {
0.5% .one;
2.0% .two;
- "";
}
server {
location / {
index index${variant}.html;
split-clients
http {
split_clients "${remote_addr}AAA" $variant {
0.5% .one;
2% .two;
3% .eric;
4% .yang;
50% .thr;
* "";
}
server {
location / {
index index${variant}.html;
}
cd /usr/local/nginx/html/ echo "one" >index.one.html echo "two" >index.two.html echo "eric" >index.eric.html echo "thr" >index.thr.html
wiki : split-clients eric:split_clients wiki : remote-addr eric: remote_addr wiki : - ""; eric: * "";关于这些错误的发现是因为 nginx 有 remote_addr 变量 并没有 remote-addr ·我就顺藤摸瓜· 随后我来讲下 Split Clients模块的一点点知识,我自己时间测试出来的~ 关于测试,我们在 nginx 的错误日志上 输出 ${variant} 变量
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$variant"';
以便于我们测试结果。
Split Clients 的模块 模块 是切割 客户端IP 然后然后 使用CRC32的 算出一个值去匹配·
在 俄文网站上 翻译出这么一段:
该指令创造了A / B分割一变
测试,例如:
http {
split_clients "${remote_addr}AAA" $variant {
0.5% .one;
2% .two;
* "";
}
原来的字符串变量的值是哈希
使用CRC32的。在这个例子中,当
哈希值从0到21474836(0.5%),变量$变种
有值“。之一”。如果哈希值21474837
至107374182(2%) - “。两个”。而如果从107374183哈希值
4294967297 - “”。
也就是说,比如 我的IP地址是 192.168.1.29 服务器IP 为 192.168.1.28
当我访问 nginx 的时候,nginx 会切割我的IP地址 匹配到 .1
日志:
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有