配置静态缓存

1
2
3
4
5
6
7
8
9
10
11
<IfModule 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 image/jpg "access plus 24 hours"
ExpiresByType test/css "now plus 2 hours"
ExpiresByType application/x-javascript "now plus 2 hours"
ExpiresByType application/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
</IfModule>

或者使用mod_headers模块来实现

1
header set cache-control "max-age=3600"