标签:apache缓存模块expires apache expires
一.检查是否安装
1.静态编译
bin/apachectl -l|grep mod_expires
mod_expires.c
2.动态编译
grep mod_expires conf/httpd.conf
或者
ll /application/apache/modules/ |grep expires
3.以DSO的方法补装
/application/apache/bin/apxs -c -i -a mod_expires.c
apxs是一个为apache编译安装扩展模块的工具."--with-apxs2=/application/apache/bin/apxs";apxs参数说明:
-c此选项表示需要执行编译操作
-i 此选项表示需要执行安装操作,安装一个或多个动态对象到服务器的Modules目录中
-a 此选项自动增加一个LoadModule行到httpd.conf文件中以激此模块
二.添加配置
1.添加配置代码:
ExpiresActive on
ExpiresDefault "access plus 12 month"
ExpiresByType text/html "access plus 12 months"
ExpiresByType text/css "access plus 12 months"
ExpiresByType image/gif "access plus 12 months"
ExpiresByType image/jpeg "access plus 12 months"
ExpiresByType image/jpg "access plus 12 months"
ExpiresByType image/png "access plus 12 months"
EXpiresByType application/x-shockwave-flash "access plus 12 months"
EXpiresByType application/x-javascript "access plus 12 months"
ExpiresByType video/x-flv "access plus 12 months"
2.作用域:
A.server config, virtual host, directory, .htaccess
B.争对具体的目录在http.conf中设置的缓存实例
<Directory "/data/www/blog/wp-content/">
ExpiresByType image/gif "access plus 12 months"
ExpiresByType image/jpeg "access plus 12 months"
ExpiresByType image/jpg "access plus 12 months"
ExpiresByType image/png "access plus 12 months"
</Directory>
本文出自 “蜘蛛侠” 博客,请务必保留此出处http://txidc.blog.51cto.com/9138217/1566047
标签:apache缓存模块expires apache expires
原文地址:http://txidc.blog.51cto.com/9138217/1566047