如何让varnish不缓存特定的url

编辑/etc/varnish/defualt.vcl文件
不缓存站点www.example.com和example.com的内容

vi /etc/varnish/defualt.vcl

sub vcl_recv {

......
......
......

   # do not cache example.com
   if (req.http.host ~ "(www.example.com|example.com)") {
     return(pass);
   }

    return (lookup);
}

重启varnish

编辑完成后,重新启动varnish

/etc/init.d/varnish restart
日期:2019-08-20 17:58:31 来源:oir作者:oir