nginx配置静态缓存的过期时间
2017-01-07 14:32
337 查看
我们可以把指定文件类型日志不记录和静态缓存的过期时间结合在一起:
location ~ .*\.(gif|jpg|png|jpeg|bmp|swf)$ { expires 15d; #表示15天过期 # expires 24h; #表示24小时过期 access_log off; }重新加载配置文件后,我们可以用curl来看一下配置是否正确:
[root@lnmp conf]# curl -x127.0.0.1:80 "http://www.test.com/data/attachment/forum/201701/04/142317dh9fav9kfwor3odf.jpg" -I HTTP/1.1 200 OK Server: nginx/1.4.4 Date: Wed, 04 Jan 2017 06:25:18 GMT Content-Type: image/jpeg Content-Length: 80837 Last-Modified: Wed, 04 Jan 2017 06:23:17 GMT Connection: keep-alive ETag: "586c94d5-13bc5" Expires: Thu, 19 Jan 2017 06:25:18 GMT Cache-Control: max-age=1296000 #单位为秒,恰好为15天 Accept-Ranges: bytes
相关文章推荐
- nginx设置静态页面压缩缓存和过期时间设置
- Nginx设置静态页面压缩和缓存过期时间的方法
- nginx设置静态页面压缩缓存和过期时间
- nginx配置静态文件过期时间
- Nginx 配置静态文件过期时间&防盗链
- Nginx设置静态页面压缩和缓存过期时间的方法
- nginx配置静态文件过期时间
- Nginx设置Js、Css等静态文件的缓存过期时间
- nginx配置静态文件过期时间
- Nginx如何配置静态文件过期时间
- nginx配置静态文件过期时间
- Nginx配置——配置静态文件过期时间
- LNMP搭建10:Nginx配置静态文件过期时间
- LNMP - nginx配置静态文件过期时间
- 2.1-nginx配置静态文件过期时间
- CentOS7 Nginx配置--静态文件过期时间、防盗链、访问控制
- LNMP - Nginx配置静态文件缓存时间
- nginx配置静态文件过期时间
- nginx设置wordpress静态资源压缩和过期时间设置
- Nginx配置文件详细说明,包括基本配置,反向代理配置,expire缓存过期,适合接入CDN的配置