Qui*_*Par 5 nginx reverse-proxy
我的静态资产配置为
location @upstream {
proxy_pass http://localhost:82;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri @upstream;
access_log off;
expires max;
add_header Cache-Control public;
}
Run Code Online (Sandbox Code Playgroud)
不遵守 expires max 。
我认为它尊重传入的服务器标头。
如何修改它以设置 expires 标头?
Nginx 只应用一个位置,绝不会应用更多。在您的示例中,它将把 expires 标头应用于现有的静态文件,但任何未找到且来自 @upstream 位置的文件都将忽略来自静态位置的 access_log、expires 和 add_header 指令。
如果您想设置过期时间,您应该在两个位置复制该指令。可能还需要设置proxy_hide_header 。
归档时间: |
|
查看次数: |
3673 次 |
最近记录: |