1>编译mod_deflate模块
#/usr/local/apache2/bin/apxs -i -c -a
/home/sense/software/server/httpd-2.2.6/modules/filters/mod_deflate.c
apxs命令参数说明:
-i 此选项表示需要执行安装操作,以安装一个或多个动态共享对象到服务器的modules目录中。
-a 此选项自动增加一个LoadModule行到httpd.conf文件中,以激活此模块,或者,如果此行已经存在,则启用之。
-A 与 -a
选项类似,但是它增加的LoadModule命令有一个井号前缀(#),即此模块已经准备就绪但尚未启用。
-c 此选项表示需要执行编译操作。它首先会编译C源程序(.c)files为对应的目标代码文件(.o),然后连接这些目标代码和files中其余的目标代码文件(.o和.a),以生成动态共享对象dsofile
。如果没有指定 -o 选项,则此输出文件名由files中的第一个文件名推测得到,也就是默认为mod_name.so 。
#vi http.conf
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built
as a DSO you
# have to place corresponding `LoadModule’ lines at this location
so the
# directives contained in it are actually available _before_ they
are used.
# Statically compiled modules (those listed by `httpd -l’) do not
need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
LoadModule php5_module
modules/libphp5.so
LoadModule deflate_module
modules/mod_deflate.so
#
3>错误处理:
# /usr/local/apache2/bin/apachectl -t
Syntax error on line 423 of /usr/local/apache2/conf/httpd.conf:
Invalid command ’Header’, perhaps misspelled or defined by a module
not included in the server configuration
解决方案:安装mod_headers.c模块
/usr/local/apache2/bin/apxs -i -c -a
/home/sense/software/server/httpd-2.2.6/modules/metadata/mod_headers.c
重新测试:
# /usr/local/apache2/bin/apachectl -t
httpd: Could not reliably determine the server’s fully qualified
domain name, using 127.0.0.1 for ServerName
Syntax OK