我也在我的服务器上安装了清漆,但性能没有改变, http : //www.webpagetest.org/说caching系统不启用您的服务器,我使用默认configuration的清漆,这是我的头:
status: HTTP/1.1 200 OK Server: Apache X-Powered-By: PHP/5.3.29 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Expires: Mon, 1 Jan 2001 00:00:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: 73ab794b527721e09d2124da5815cf79=2f8ca1fed15724e75f5bf3824a26a9cd; path=/; HttpOnly Last-Modified: Thu, 25 Sep 2014 08:28:53 GMT Content-Type: text/html; charset=utf-8 Content-Length: 77965 Accept-Ranges: bytes Date: Thu, 25 Sep 2014 08:28:53 GMT X-Varnish: 1531877383 Age: 0 Via: 1.1 varnish Connection: close
我会看看我是否可以帮助这个问题的任何未来的观点,有许多事情会导致清漆不caching内容。 您需要完成所有这些工作,并希望有一个良好的日志logging/度量标准设置,以便您可以确定哪些页面/资源没有响应caching。
您的caching控制标题是:
status: HTTP/1.1 200 OK Server: Apache X-Powered-By: PHP/5.3.29 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Expires: Mon, 1 Jan 2001 00:00:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: 73ab794b527721e09d2124da5815cf79=2f8ca1fed15724e75f5bf3824a26a9cd; path=/; HttpOnly Last-Modified: Thu, 25 Sep 2014 08:28:53 GMT Content-Type: text/html; charset=utf-8 Content-Length: 77965 Accept-Ranges: bytes Date: Thu, 25 Sep 2014 08:28:53 GMT X-Varnish: 1531877383 Age: 0 Via: 1.1 varnish Connection: close
为了让这个特殊的请求可以caching,你需要修复:
Expires: Mon, 1 Jan 2001 00:00:00 GMT
这告诉Varnish不要caching
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
这告诉Varnish不要caching(Varnish 4+,Varnish 3仍然会caching这个)
Set-Cookie: 73ab794b527721e09d2124da5815cf79=2f8ca1fed15724e75f5bf3824a26a9cd; path=/; HttpOnly
光油不会cachingSet-Cookie的任何回应
为了解决指标/日志logging,以便您可以看到我所写的关于清漆设置选项的所有请求: https : //www.section.io/varnish-install-quick-and-detailed/
你的问题在这里:
Cache-Control:no-store,no-cache …
基本上:
在你的VCL中使用下面的内容
sub vcl_fetch { remove beresp.http.Cache-Control; set beresp.http.Cache-Control = "public"; }