1、安装
直接使用apxs添加新的模块
/www2/local/apache/bin/apxs -i -a -c /www1/soft/httpd-2.2.8/modules/filters/mod_deflate.c
出现错误
Warning! dlname not found in /www2/local/apache/modules/mod_deflate.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /www2/local/apache/modules/mod_deflate.so
chmod: 无法访问‘/www2/local/apache/modules/mod_deflate.so’: 没有那个文件或目录
apxs:Error: Command failed with rc=65536
解决方法
gcc -shared -o mod_deflate.so /www1/soft/httpd-2.2.8/modules/filters/mod_deflate.o
2、简单使用。
压缩基础的类型 html js Css
在配置文件中添加
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-PHP application/x-JavaScript text/css
AddOutputFilter DEFLATE css js
注意:不同浏览器对压缩的支持程度不一样,要更好的设计。
"apache2的mod_deflate安装使用手记"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Server/Apache/17825.html