编辑“虚拟主机配置文件”
在CustomLog那一行下面加入文档
<IfModule mod_expires.c> ## 这里用mod_expires.c模块
ExpiresActive on
ExpiresByType image/gif "access plus 1 days"
ExpiresByType image/jpeg "access plus 24 hours"
ExpiresByType image/png "access plus 24 hours"
ExpiresByType test/css "now plus 2 hour"
ExpiresByType application/x-javascript "now plus 2 hours"
ExpiresByType application/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
</IfModule>
红字部分为缓存的时间
[root@LAMPLINUX ~]# apachectl -t
Syntax OK
[root@LAMPLINUX ~]# apachectl restart
原文地址:http://286577399.blog.51cto.com/10467610/1673206