apache 扩展模块
apache 扩展模块
- 查看相应模块是否安装:httpd -l 或者 httpd -M | grep module_name
root@ubuntu:/usr/src/local/httpd-2.4.29# httpd -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_dbm.c
mod_authn_anon.c
mod_authn_dbd.c
mod_authn_socache.c
mod_authn_core.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_dbm.c
mod_authz_owner.c
mod_authz_dbd.c
......省略
- 如果没有安装则到源码目录:
cd /usr/src/local/httpd-2.4.29
cd modules
搜索模块的源文件在哪: find . -name “mod_deflate.c”
root@ubuntu:/usr/src/local/httpd-2.4.29/modules# find . -name "mod_deflate.c"
./filters/mod_deflate.c
找到源码文件后 ,然后使用apxs 进行源码扩展模块: /usr/local/apache2.4/bin/apxs -i -a -c filters/mod_deflate.c
然后查看模块是否已经安装:httproot@ubuntu:/usr/src/local/httpd-2.4.29/modules# httpd -l | grep mod_deflate.c
mod_deflate.c
root@ubuntu:/usr/src/local/httpd-2.4.29/modules# httpd -M |grep deflate
deflate_module (static)
# exp:
find /home/xujb -name "mod_ssl.c" bin/apxs -i -a -c /home/xujb/download/apache/httpd-2.4.58/modules/ssl/mod_ssl.c 报错:/home/xujb/download/apache/httpd-2.4.58/modules/ssl/ssl_private.h:87:30: fatal error: openssl/opensslv.h: No such file or directory 没有安装 libssl: centos-> yum -y install openssl-devel bin/apxs -i -a -c /home/xujb/download/apache/httpd-2.4.58/modules/ssl/mod_ssl.c chmod 755 /home/xujb/soft/httpd-2.4.58/modules/mod_ssl.so 以上会报错: Cannot load modules/mod_ssl.so into server: /home/xujb/soft/httpd-2.4.58/modules/mod_ssl.so: undefined symbol: ssl_cmd_SSLPassPhraseDialog /home/xujb/soft/httpd-2.4.58/bin/apxs -i -a -c -L/usr/lib/openssl/engines/lib -c *.c -lcrypto -lssl -ldl cd 到 apache 源码 /home/xujb/download/apache/httpd-2.4.58/modules/ssl /home/xujb/soft/httpd-2.4.58/bin/apxs -i -a -c -L/usr/lib/openssl/engines/lib -c *.c -lcrypto -lssl -ldl 报错: fatal error: mod_md.h: No such file or directory cp ../md/mod_md.h . 然后在执行: /home/xujb/soft/httpd-2.4.58/bin/apxs -i -a -c -L/usr/lib/openssl/engines/lib -c *.c -lcrypto -lssl -ldl 然后测试 /home/xujb/soft/httpd-2.4.58/bin/httpd -t