apache配置expires_module缓存静态文件

Apache版本apache_2.2.14-win32-x86-openssl-0.9.8k.msi

修改httpd.conf文件:
1,去掉#LoadModule expires_module modules/mod_expires.so这行前面的#号

2,增加如下配置
<IfModule expires_module>
  ExpiresActive On
  ExpiresDefault "access plus 2 days"
  ExpiresByType application/x-shockwave-flash "access plus 3 days"
</IfModule>


restart apache服务器就生效了
通过httpwatch观察http请求Headers Received:
Expires已经是两天后了

(Status-Line)	HTTP/1.1 200 OK
Accept-Ranges	bytes
Cache-Control	max-age=172800
Connection	Keep-Alive
Content-Length	561276
Content-Type	image/jpeg
Date	Fri, 18 Nov 2011 02:18:18 GMT
ETag	"2000000010a90-8907c-46ea3c3de04ac"
Expires	Sun, 20 Nov 2011 02:18:18 GMT
Keep-Alive	timeout=5, max=99
Last-Modified	Tue, 14 Jul 2009 05:32:31 GMT
Server	Apache/2.2.14 (Win32)

你可能感兴趣的:(apache配置expires_module缓存静态文件)