gpt4 book ai didi

nginx - 如何解决Google页面速​​度: "expiration not specified"

转载 作者:行者123 更新时间:2023-12-02 07:43:39 28 4
gpt4 key购买 nike

使用 GooglePageSpeed 分析在线商店(Shopware)导致每个图像上出现许多“未指定到期时间”的线条。

enter image description here

我想知道是因为网络服务器 (nginx) 在所有图像的响应中添加了 Last-Modified-Timestamps 和 ETAG header ,从而导致了预期的 304 响应根据第二个请求。

enter image description here

Google Page Speed 是否不支持 ETAG/LastModified?

我将提供 nginx 配置的适当部分:

location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

## All static files will be served directly.
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|html|xml)$ {
## Defining rewrite rules
rewrite files/documents/.* /engine last;
rewrite backend/media/(.*) /media/$1 last;

expires 1w;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";

access_log off;
# The directive enables or disables messages in error_log about files not found on disk.
log_not_found off;

tcp_nodelay off;
## Set the OS file cache.
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

## Fallback to shopware
## comment in if needed
#try_files $uri @shopware;
}

有什么错误或者遗漏的地方吗?

最佳答案

最后我们发现,vhost-config 中还有另一个过期语句。将两者减少为一个语句解决了我们的问题

关于nginx - 如何解决Google页面速​​度: "expiration not specified",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39063666/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com