鉴于下面的示例location
示例,-1
对expires
意味着什么?这是否意味着“永不过期”或“永不缓存”?
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
access_log logs/static.log;
}
https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/expires.conf
答案 0 :(得分:10)
根据nginx manual,此指令将Expires
和Cache-Control
HTTP标头添加到响应中。
值-1
表示这些标头设置为:
Expires:
当前时间减去1秒
Cache-Control: no-cache
总而言之,它指示浏览器不要缓存文档。
答案 1 :(得分:3)
如果使用expires -1
,则表示永远不会缓存这些页面。 expire
指令指示浏览器在一定时间(或某个特定时间)之后使文件缓存失效。如果给出负值,则没有缓存。