Apache HTTPD Server:内存缓存的使用

  1. 打开httpd.conf文件
  2. 开启”cache_module”,”expires_module”,”headers_module”还有”mem_cache_module”组件(去掉它们前面的’#’字符)
  3. 在httpd.conf里插入以下行(缓存文件类型:图片,文本,缓存大小:10MB)

<IfModule headers_module>
<filesMatch “\.(ico\|png\|gif\|css\|js\|html)$”>
Header set Cache-Control “max-age=2592000, public”
</filesMatch>
Header unset ETag
Header unset Last-Modified
</IfModule>
FileETag None
<IfModule expires_module>
ExpiresActive On
ExpiresByType image/x-icon “access plus 2592000 seconds”
ExpiresByType image/png “access plus 2592000 seconds”
ExpiresByType image/gif “access plus 2592000 seconds”
ExpiresByType text/css “access plus 2592000 seconds”
ExpiresByType text/html “access plus 2592000 seconds”
</IfModule>
<IfModule mem_cache_module>
CacheEnable mem /
MCacheSize 10240
</IfModule>

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s