varnish 4.0.3 域名访问的小问题

1,若端口不是80 端口则匹配的时候必须加端口

if (req.http.host ~ "(?i)^var.test.aa:6081$") {
set req.http.host = "var.test.aa";  #效果 X-Cache:MISS from var.test.aa 下面没有的话X-Cache:MISS from nish.test.bb:6081

set req.backend_hint = apache.backend();

} elsif (req.http.host ~ "(?i)^nish.test.bb:6081$") {
set req.backend_hint = nginx.backend();
}

2.varnish 代理本机nginx 是,好似不管怎么样配置,指定了域名和端口都会默认代理到 80端口的第一个nginx 配置

3.

sub vcl_init {
#new apache = directors.random();  #下面这两种都有效
new apache = directors.round_robin();
apache.add_backend(web1);
#new nginx = directors.random();
new nginx = directors.round_robin();
nginx.add_backend(web2);
}

posted on 2016-07-26 11:27  yang68h  阅读(239)  评论(0编辑  收藏  举报