检查命令
curl -i
安装目录中
cd /etc/varnish
消空缓存
varnishadm ban req.url "-" /
多后端配置服务
acl ciilii {
"127.0.0.1";
"175.2.2.0"/24;
}
backend web1 {
.host ="11111"
.port = "80"
}
backend web2 {
.host ="22222"
.port = "80"
}
import directors from "/usr/lib64/varnish/vmods/libmod_directors.so";
sub vcl_int {
new lb = directors.round_robin();
lb.add_backend(web1);
lb.add_backend(web2);
}
sub vcl_recv {
if (req.http.host ~"^(www.)?ciilii.com"){
set req.http.host ="www.ciilii.com";
set req.backend_hint = lb.backend();
}elseif (req.http.host ~"^docker.ciilii.com") {
set req.backend_hint = web2;
}else{
return (synth(405));
}
if (req.method == "ban") {
if (!clint.ip ~ ciilii) {
return(synth(405,"Not Allow"));
}
ban("req.url ~" + req.url);
return(purge);
}
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有