本文介绍了NGINX的location指令中的expires -1是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出下面的示例location示例,-1expires意味着什么?这是否意味着永不过期"或永不缓存"?

Given the sample location example below, what does -1 mean for expires? Does that mean "never expires" or "never caches"?

# 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

推荐答案

根据 nginx manual ,此指令将ExpiresCache-Control HTTP标头添加到响应中.

According to nginx manual, this directive adds the Expires and Cache-Control HTTP header to the response.

-1表示将这些标头设置为:

Value -1 means these headers are set as:

Cache-Control: no-cache

因此,总而言之,它指示浏览器不要缓存文档.

So in summary it instructs the browser not to cache the document.

这篇关于NGINX的location指令中的expires -1是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 05:57