1、找到源码目录下的mod_deflate.c文件,进入源码目录
2、编译安装
/usr/local/apache/bin/apxs -i -a -c mod_deflate.c
3、如果在安装apache的时候入到 error: mod_deflate has been requested but can not be built due to prerequisite failures的错误,那是没有安装zlib包
4、安装 zlib包
yum install zlib -y
5启动apache
6、 启动apache如果报错(Cannot load modules/mod_deflate.so into server: /application/apache2.4.6/modules/mod_deflate.so: undefined symbol: inflateEnd)需要在需要在 LoadModule deflate_module modules/mod_deflate.so 的前面加载zlib.so
7、重新启动apache