apache扩展模块安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache扩展模块安装相关的知识,希望对你有一定的参考价值。
因为需求,所以我要安装一个扩展模块,该扩展模块名为mod_headers,那应该怎样去添加扩展模块呢?
首先,添加扩展模块要用到的工具是:/usr/local/apache2/bin/apxs
也就是Apache的安装路径下的目录中
首先,去你下载的源码包目录中。就是你刚开始安装Apache的时候(./configure的时候),该源码包看你放在哪,一般是在/usr/local/src/目录下的
#cd /usr/local/usr/
之后在当前目录下查找mod_headers.c文件放在哪?
#find /usr/local/src/httpd-2.2.31 -name "*.c" | grep ‘mod_headers.c‘
#cd modules
#cd metadata
在该目录下,执行安装命令:
#/usr/local/apache2/bin/apxs -i -a -c mod_headers.c
[[email protected] metadata]# /usr/local/apache2/bin/apxs -i -a -c mod_headers.c
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -c -o mod_headers.lo mod_headers.c && touch mod_headers.slo
/usr/local/apache2/build/libtool --silent --mode=link gcc -o mod_headers.la -rpath /usr/local/apache2/modules -module -avoid-version mod_headers.lo
/usr/local/apache2/build/instdso.sh SH_LIBTOOL=‘/usr/local/apache2/build/libtool‘ mod_headers.la /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp mod_headers.la /usr/local/apache2/modules/
cp .libs/mod_headers.so /usr/local/apache2/modules/mod_headers.so
cp .libs/mod_headers.lai /usr/local/apache2/modules/mod_headers.la
cp .libs/mod_headers.a /usr/local/apache2/modules/mod_headers.a
chmod 644 /usr/local/apache2/modules/mod_headers.a
ranlib /usr/local/apache2/modules/mod_headers.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/apache2/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apache2/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR‘
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH‘ environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH‘ environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR‘ linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf‘
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache2/modules/mod_headers.so
[activating module `headers‘ in /usr/local/apache2/conf/httpd.conf]
-c : 编译
-i : 安装
-a : 在配置文件中自动添加IfModule信息。(配置文件:/usr/local/apache2/conf/httpd.conf)
#cat /usr/local/apache2/conf/httpd.conf | grep ‘LoadModule‘
查看有没有成功安装:/usr/local/apache2/bin/apachectl -M
本文出自 “11842333” 博客,转载请与作者联系!
以上是关于apache扩展模块安装的主要内容,如果未能解决你的问题,请参考以下文章