9

我正在维护的 Wordpress 博客之一没有使用插件Varnish HTTP Purge 清除缓存。无论是使用清漆缓存清除按钮还是在我们编辑帖子时。

为了知道问题的原因,我想知道一种方法来检查清除请求是否到达 Varnish 服务器,可能使用 varnishlog 命令。

http://wordpress.org/plugins/varnish-http-purge/

4

3 回答 3

20

清漆 4.0

varnishlog -g request -q 'ReqMethod eq "PURGE"'
于 2015-04-08T23:05:06.283 回答
6

Varnish 3.x

varnishlog -d -c -m RxRequest:PURGE

That will output any of the purges in memory. And without -d it will output only current requests:

varnishlog -c -m RxRequest:PURGE

From man varnishlog:

-d Process old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts.

于 2014-01-02T23:16:03.290 回答
0

它可以像清漆配置一样简单,将清除请求限制到某个 IP 或一组 IP。我知道我的典型清漆配置包括:

acl purge {
  "127.0.0.1";
  "123.45.67.0"/24;
}

sub vcl_recv {
  ....

  if (req.request == "PURGE") {
    if (!client.ip ~ purge) {
      error 405 "Not allowed.";
    }   
    return (lookup);
  }

  ....
}   

我会先检查一下,尤其是从 varnish 网站上的一些示例中复制了配置。几乎所有这些都包含用于清除的 ACL。

于 2013-12-21T05:32:47.900 回答