如何向 apache2 Centos6 添加新模块

如何向 apache2 Centos6 添加新模块

当我编译 apache 时我忘记添加,proxy_http_module现在该如何添加它?

我的apache安装在这里:/usr/local/apache2

我尝试再次编译并收到此错误:

make[1]: Leaving directory `/root/httpd-2.2.31/support'
make[1]: Entering directory `/root/httpd-2.2.31'
/root/httpd-2.2.31/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread        -I. -I/root/httpd-2.2.31/os/unix -I/root/httpd-2.2.31/server/mpm/prefork -I/root/httpd-2.2.31/modules/http -I/root/httpd-2.2.31/modules/filters -I/root/httpd-2.2.31/modules/proxy -I/root/httpd-2.2.31/include -I/root/httpd-2.2.31/modules/generators -I/root/httpd-2.2.31/modules/mappers -I/root/httpd-2.2.31/modules/database -I/root/httpd-2.2.31/srclib/apr/include -I/root/httpd-2.2.31/srclib/apr-util/include -I/root/httpd-2.2.31/server -I/root/httpd-2.2.31/modules/proxy/../generators -I/root/httpd-2.2.31/modules/ssl -I/root/httpd-2.2.31/modules/dav/main -fPIE -prefer-non-pic -static -c modules.c && touch modules.lo
gcc -g -O2 -pthread        -I. -I/root/httpd-2.2.31/os/unix -I/root/httpd-2.2.31/server/mpm/prefork -I/root/httpd-2.2.31/modules/http -I/root/httpd-2.2.31/modules/filters -I/root/httpd-2.2.31/modules/proxy -I/root/httpd-2.2.31/include -I/root/httpd-2.2.31/modules/generators -I/root/httpd-2.2.31/modules/mappers -I/root/httpd-2.2.31/modules/database -I/root/httpd-2.2.31/srclib/apr/include -I/root/httpd-2.2.31/srclib/apr-util/include -I/root/httpd-2.2.31/server -I/root/httpd-2.2.31/modules/proxy/../generators -I/root/httpd-2.2.31/modules/ssl -I/root/httpd-2.2.31/modules/dav/main -fPIE -c /root/httpd-2.2.31/server/buildmark.c
/root/httpd-2.2.31/srclib/apr/libtool --silent --mode=link gcc -g -O2 -pthread   -pie     -o httpd  modules.lo buildmark.o -export-dynamic server/libmain.la modules/http/libmod_http.la modules/mappers/libmod_so.la server/mpm/prefork/libprefork.la os/unix/libos.la -lm -lpcre /root/httpd-2.2.31/srclib/apr-util/libaprutil-1.la -lexpat /root/httpd-2.2.31/srclib/apr/libapr-1.la -lrt -lcrypt -lpthread 
/usr/bin/ld: server/.libs/libmain.a(main.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
server/.libs/libmain.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/root/httpd-2.2.31'
make: *** [all-recursive] Error 1

这是我的配置:

./configure --with-mpm=prefork --with-included-apr --enable-mods-shared=all --enable-so --enable-pie --enable-cgi --with-pcre --enable-ssl --enable-rewrite --enable-vhost-alias --enable-proxy --enable-proxy-http --enable-proxy-ftp --enable-proxy-balancer --enable-cache --enable-mem-cache --enable-file-cache --enable-disk-cache --disable-spelling --enable-dav --enable-ldap --enable-authnz-ldap --enable-authnz-ldap --enable-authn-anon --enable-authn-alias --build=i686

答案1

因为它包含在 apache 源中,在我看来,最简单的方法是转到您使用的源目录,重新配置它并添加 mod_proxy,然后进行安装。它不会覆盖您的配置文件。

make clean重新编译之前一定要先

顺便说一句,我建议您将所有模块启用为共享。

当您使用树外模块时的另一种方法是使用您可以在安装目录中找到的 apxs,但在您的情况下,重新编译/

相关内容