![](/img/trans.png)
[英]CakePHP Google PageSpeed Insights Leverage browser caching
[英]Leverage Browser Caching in PageSpeed Insights with Varnish & Nginx
有誰知道如何使用Varnish Cache和Nginx從PageSpeed Insights中刪除“杠桿瀏覽器緩存”消息?
我嘗試將位置〜* ...塊添加到服務器塊,但這使站點崩潰。 我想我缺少清漆設置,但找不到。
提前致謝!
要覆蓋這些標頭,並且仍將元素放入緩存2分鍾,可以使用以下配置:
sub vcl_fetch {
if (beresp.ttl < 120s) {
set beresp.ttl = 120s;
# Set the clients TTL on this object
set beresp.http.Cache-Control = "max-age=120";
}
}
或者,以Varnish 4.0術語:
sub vcl_backend_response {
if (beresp.ttl < 120s) {
set beresp.ttl = 120s;
unset beresp.http.Cache-Control;
set beresp.http.Cache-Control = "max-age=120";
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.