Drupal 7 我的清漆装置能用吗?

Drupal 7 我的清漆装置能用吗?,drupal-7,varnish,Drupal 7,Varnish,我正在本地Centos/LAMP虚拟机上测试Drupal 7,未连接到Internet,安装了Varnish和Varnish模块 我分不清清漆是否起作用。由于我无法将我的实例放到Internet上,因此我无法使用它进行测试 Chrome在以下位置返回: 第一次运行: 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.1

我正在本地Centos/LAMP虚拟机上测试Drupal 7,未连接到Internet,安装了Varnish和Varnish模块

我分不清清漆是否起作用。由于我无法将我的实例放到Internet上,因此我无法使用它进行测试

Chrome在以下位置返回:
第一次运行:

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: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: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
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
curl-Ij返回以下内容:
第一次运行:

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: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: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
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
这是my/etc/varnish/default.vcl的一部分:

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}
这是my/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
看起来清漆对卷曲有效,但对铬不起作用。从我在Drupal下读到的关于Varnish的内容来看,我应该看到X-Varnish的两个值,这是我在第二次卷曲时看到的,但在Chrome中没有看到。我不知道我是否应该将Drupal缓存视为一个热门,因为Varnish不提供缓存?但是,没有看到任何表示“击中清漆”的内容

任何帮助都会很好

谢谢

针对Ronald的问题,以下是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" GET/data HTTP/1.1 主机:本地主机 连接:保持活力 缓存控制:最大年龄=0 升级不安全的请求:1 用户代理:Mozilla/5.0(X11;Linux x86_64)AppleWebKit/537.36(KHTML,类似Gecko)Chrome/52.0.2743.116 Safari/537.36 接受:text/html、application/xhtml+xml、application/xml;q=0.9,图像/webp,*/*;q=0.8 接受编码:gzip、deflate、sdch 接受语言:en-US,en;q=0.8 Cookie:has_js=1 如果没有匹配:“1473274273-1”
chrome发送的请求是什么样子的。包括饼干吗?嗨,罗纳德。在回答你的问题时,我在帖子中添加了Chrome请求头。我对Drupal一无所知,但默认配置下的Varnish不会缓存任何cookie。必须删除请求上的Cookie头和VCL中的响应上的Set Cookie头,以便Varnish进行缓存。我认为Drupal会发送正确的头(带或不带Cookie)来获取Varnish可以缓存的页面,因为我使用的是Drupal Varnish模块。我仍然不知道我的问题是Drupal、Varnish还是两者都有。chrome发送的请求是什么样子的。包括饼干吗?嗨,罗纳德。在回答你的问题时,我在帖子中添加了Chrome请求头。我对Drupal一无所知,但默认配置下的Varnish不会缓存任何cookie。必须删除请求上的Cookie头和VCL中的响应上的Set Cookie头,以便Varnish进行缓存。我认为Drupal会发送正确的头(带或不带Cookie)来获取Varnish可以缓存的页面,因为我使用的是Drupal Varnish模块。我仍然不知道我的问题是Drupal、Varnish还是两者兼而有之。