Nginx 设置静态网站内容的缓存时间

1
2
3
4
5
6
7
8
9
10
11
map $sent_http_content_type $expires {
default off;
text/html 1h;
text/css 6h;
application/javascript 1h;
~image/ 7d;
}

server {
expires $expires;
}

参考:

How to Implement Browser Caching with Nginx’s header Module on CentOS 7

浏览器缓存详解:expires,cache-control,last-modified,etag 详细说明

Donate - Support to make this site better.
捐助 - 支持我让我做得更好.