1、配置指定文件不记录日志,同时设置静态文件过期时间
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 15d;
access_log off;
}
2、只配置静态文件过期时间
#配置静态文件过期时间
location ~ \.(js|css)$
{
expires 15d;
}
d 天 h 小时 m 分钟

用curl 查看本地127.0.0.1访问。
如:curl -x127.0.0.1:80 www.dd.com/data/cache/style_1_forum_index.css?x70 -I
-A:可以指定浏览器标识user_agent
-I: 可以只查看状态信息。

其中Cache-Control一行就是过期时间,默认时间单位为秒