添加deflate gzip模块到apache2服务器

compile deflate gzip module for apache2

 ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-modules=allConfiguring Apache Portable Runtime Utility library...checking for APR-util... yesconfigure: error: Cannot use an external APR-util with the bundled APR

如果编译过程中发现APR-util的错误,可以加上--with-included-apr这个参数,如下:

 ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-modules=all --with-included-apr make cp ./modules/filters/.libs/mod_deflate.so /usr/local/apache2/modules vi /usr/local/apache2/conf/httpd.conf# append 2 line to httpd.confLoadModule deflate_module modules/mod_deflate.soAddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-json application/x-javascript /usr/local/apache2/bin/apachectl graceful

更多关于deflate module的设置可参考官方说明

References

  1. http://yuweijun.blogspot.com/2007/09/apache22module.html