【问题标题】:Varnish isnt caching with pagespeed清漆不使用 pagespeed 缓存
【发布时间】:2016-11-01 17:19:21
【问题描述】:

我正在使用 nginx pagespeed + varnish 但 varnish 不是缓存。 wordpress 运行良好..但是清漆(4.0)我没有通过 curl 得到响应

curl -I http://example.com

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Vary: Accept-Encoding
Link: <http://www.example.com/wp-json/>; rel="https://api.w.org/"
Date: Tue, 01 Nov 2016 17:04:57 GMT
X-Page-Speed: 1.11.33.4-0
Cache-Control: max-age=0, no-cache
Age: 196
X-Cache: cached
Accept-Ranges: bytes
Connection: keep-alive

cat /etc/default/varnish

....
DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m"

cat /etc/varnish/default.vcl

...
backend default {
    .host = "127.0.0.1";
    .port = "8081";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .between_bytes_timeout = 600s;
    .max_connections = 800;
}


$ ps aux -P | grep varnish
varnish  24427  0.0  0.6 125044  6920 ?        Ss   17:04   0:00 /usr/sbin/varnishd
varnish  24461  0.0  0.7 125044  7776 ?        Ss   17:04   0:00 /usr/sbin/varnishd -j unix,user=varnish -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
vcache   24473  0.0  9.2 272024 93352 ?        Sl   17:04   0:00 /usr/sbin/varnishd -j unix,user=varnish -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

用户 varnish 和 vcache 是具有特权 (sudo) 的组中的用户。

$ cat /usr/local/nginx/conf/nginx.conf

...
  server {
       listen       127.0.0.1:8081;
    ...

【问题讨论】:

    标签: nginx varnish


    【解决方案1】:

    为了让 Varnish 和 ngx_pagespeed 能够很好地协同工作,您必须配置相当复杂的 Downstream Caching

    【讨论】:

      猜你喜欢
      • 2016-04-19
      • 2021-08-05
      • 1970-01-01
      • 2011-07-02
      • 2012-04-03
      • 2018-09-12
      • 1970-01-01
      • 2016-05-25
      • 2012-08-23
      相关资源
      最近更新 更多