我的清漆安装是否正常工作?

时间:2016-09-07 18:12:41

标签: drupal-7 varnish

我测试在本地Centos / LAMP VM上运行Drupal 7,没有连接到Internet,安装了Varnish和Varnish模块。

我无法判断Varnish是否正常工作。由于我无法将我的实例放在互联网上,因此无法使用http://www.isvarnishworking.com/进行测试。

Chrome在http://localhost/data返回以下内容:
第一轮:

HTTP/1.1 200 OK
Date: Wed, 07 Sep 2016 17:22:12 GMT
Server: Apache/2.4.6 (CentOS) PHP/5.4.16
X-Powered-By: PHP/5.4.16
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: public, max-age=60
X-Content-Type-Options: nosniff
Content-Language: en
X-Frame-Options: SAMEORIGIN
X-Generator: Drupal 7 (http://drupal.org)
Etag: "1473268932-1"
Last-Modified: Wed, 07 Sep 2016 17:22:12 GMT
Vary: Cookie,Accept-Encoding
Content-Encoding: gzip
Content-Length: 7579
Content-Type: text/html; charset=utf-8
X-Varnish: 162
Age: 0
Via: 1.1 varnish-v4
Connection: keep-alive
Accept-Ranges: bytes

第二轮:

HTTP/1.1 200 OK
Date: Wed, 07 Sep 2016 17:23:01 GMT
Server: Apache/2.4.6 (CentOS) PHP/5.4.16
X-Powered-By: PHP/5.4.16
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: public, max-age=60
X-Content-Type-Options: nosniff
Content-Language: en
X-Frame-Options: SAMEORIGIN
X-Generator: Drupal 7 (http://drupal.org)
Etag: "1473268981-1"
Last-Modified: Wed, 07 Sep 2016 17:23:01 GMT
Vary: Cookie,Accept-Encoding
Content-Encoding: gzip
Content-Length: 7583
Content-Type: text/html; charset=utf-8
X-Varnish: 917543
Age: 0
Via: 1.1 varnish-v4
Connection: keep-alive
Accept-Ranges: bytes

curl -Ij http://localhost/data返回以下内容:
第一轮:

HTTP/1.1 200 OK
Date: Wed, 07 Sep 2016 17:25:27 GMT
Server: Apache/2.4.6 (CentOS) PHP/5.4.16
X-Powered-By: PHP/5.4.16
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: public, max-age=60
X-Content-Type-Options: nosniff
Content-Language: en
X-Frame-Options: SAMEORIGIN
X-Generator: Drupal 7 (http://drupal.org)
Last-Modified: Wed, 07 Sep 2016 17:25:27 GMT
Vary: Cookie,Accept-Encoding
Content-Type: text/html; charset=utf-8
X-Varnish: 786539
Age: 0
Via: 1.1 varnish-v4
ETag: W/"1473269127-1"
Connection: keep-alive

第二轮:

HTTP/1.1 200 OK
Date: Wed, 07 Sep 2016 17:25:27 GMT
Server: Apache/2.4.6 (CentOS) PHP/5.4.16
X-Powered-By: PHP/5.4.16
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: public, max-age=60
X-Content-Type-Options: nosniff
Content-Language: en
X-Frame-Options: SAMEORIGIN
X-Generator: Drupal 7 (http://drupal.org)
Last-Modified: Wed, 07 Sep 2016 17:25:27 GMT
Vary: Cookie,Accept-Encoding
Content-Type: text/html; charset=utf-8
X-Varnish: 917560 786540
Age: 26
Via: 1.1 varnish-v4
ETag: W/"1473269127-1"
Connection: keep-alive

以下是我/etc/varnish/default.vcl的一部分:

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

以下是我/etc/httpd/httpd.conf的一部分:

Listen 8080
NameVirtualHost *:8080

最后,这是我的admin / config / development / performance设置:

CACHING
Cache pages for anonymous users  (checked)
Cache blocks (checked)
Minimum cache lifetime: none
Expiration of cached pages: 1 min

看起来Varnish正在为curl工作但不适用于Chrome。根据我在Drupal下读到的关于Varnish的内容,我应该看到X-Varnish的两个值,我在第二次卷曲运行中看到但在Chrome中看不到。我不知道我是否应该将Drupal缓存视为HIT因为没有Varnish提供缓存?然而,没有看到任何说HIT for Varnish的东西。

任何帮助都会很棒。

由于

回答罗纳德的问题,以下是Chrome请求标题:

    GET /data HTTP/1.1
    Host: localhost
    Connection: keep-alive
    Cache-Control: max-age=0
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8
    Cookie: has_js=1
    If-None-Match: "1473274273-1"

0 个答案:

没有答案