Varnish不缓存多个wordpress


Varnish does not cache multiple wordpress

我已经在一个高端专用服务器上安装了Varnish,该服务器使用WHM运行大约10-13个网站,全部在WordPress上。我看到在"varnishist"中,命中率非常低,而未命中率非常高。此外,当我执行varnishtop -i txurl时,我只看到Apache以非常高的速率请求"/"URL(而不是每个网站的URL)。以下是摘录:

4.02 TxURL /
1.00 TxURL /wp-content/uploads/2014/12/034kj343.jpg
0.96 TxURL /wp-content/uploads/2014/12/dfkkj30434.jpg
0.96 TxURL /wp-content/uploads/2014/10/3403402022.jpg

我相信清漆甚至必须缓存每个网站的主页并发送回客户端,而不是从后端请求。有什么建议吗?

好。我设法找到了解决办法。这是我当前的VCL文件,它运行得非常好。

 sub vcl_recv{   
    if (req.http.Cookie && req.http.Cookie ~ "(wordpress_|PHPSESSID)")
    { return(pass); }
    if (req.url ~ "wp-admin|wp-login") {
    return (pass);
    }
    else{
    unset req.http.Cookie;
    } #since we can not unset all, but leave wp-admin
}
sub vcl_backend_response {
    if (bereq.url !~ "wp-admin|wp-login") {
            unset beresp.http.Set-Cookie;
    }
    #beware that you are ignoreing all the headers now:
    unset beresp.http.Cache-Control;
    # cache everything for 60 minutes
    if(beresp.ttl <= 0s) { set beresp.ttl = 3600s; }
}