1、修改httpd配置文件,开启apache扩展模块
LoadModule expires_module modules/mod_expires.so
2、配置缓存,在apache配置文件中加入下面一段代码
<IfModule expires_module> #打开缓存 ExpiresActive on #css文件缓存7200000/3600/24=83天 ExpiresByType text/css A7200000 #js文件缓存7200000/3600/24=83天 ExpiresByType application/x-javascript A7200000 ExpiresByType application/javascript A7200000 #html文件缓存7200000/3600/24=83天 ExpiresByType text/html A7200000 #图片文件缓存7200000/3600/24=83天 ExpiresByType image/jpeg A7200000 ExpiresByType image/gif A7200000 ExpiresByType image/png A7200000 ExpiresByType image/x-icon A7200000 </IfModule>