在centos6编译安装http-2.4

时间:2021-10-23 21:44:36

在centos6 编译安装httpd-2.4

安装httpd-2.4

Ü 依赖于apr-1.4+, apr-util-1.4+, [apr-iconv]

Ü apr: : apache portable runtime ,解决跨平台实现

Ü CentOS 6 :默认:apr-1.3.9, apr-util-1.3.9

v 安装前准备开发包:

Ü 开发环境包组:

Development Tools,Server

相关包:pcre-devel ,openssl-devel expat-devel

下载源代码并解压缩:

httpd-2.4.27.tar.bz2

apr-1.6.2.tar.bz2

apr-util-1.6.0.tar.bz2

安装apr-1.4+

cd apr-1.6.2

./configure --prefix=/app/apr

make && make install

安装apr-util-1.4+

cd ../apr-util-1.6.0

./configure --prefix=/app/apr-util --with-

apr=/app/apr/

make -j 2 && make install

编译安装httpd-2.4

cd ../httpd-2.4.27

./configure --prefix=/app/httpd24 --enable-so --

enable-ssl --enable-cgi --enable-rewrite --with-zlib

--with-pcre --with-apr=/app/apr/ --with-apr-

util=/app/apr-util/ --enable-modules=most --enable-

mpms-shared=all --with-mpm=prefork

make -j 4 && make install

centos6 编译安装httpd-2.4 方法二

cp -av apr-util-1.6.0 httpd-2.4.27/srclib/apr-util

cp -av apr-1.6.2 httpd-2.4.27/srclib/apr

cd httpd-2.4.27/

./configure --prefix=/usr/local/httpd24 --enable-

so --enable-ssl --enable-cgi --enable-rewrite --

with-zlib --with-pcre --with-included-apr --

enable-modules=most --enable-mpms-shared=all --

with-mpm=prefork

make && make install

v Httpd 编译过程:/usr/local/apache24/build/config.nice

v 自带的服务控制脚本:/usr/local/httpd24/bin/apachectl

在centos6 编译安装httpd-2.4

vim /etc/profile.d/httpd24.sh

export PATH=/app/http24/bin:$PATH

v vim /etc/man.config

MANPATH /usr/local/apache24/man

v 自 定义启动脚本( 参考httpd-2.2 的服务脚本)

cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24

vim /etc/rc.d/init.d/httpd24

apachectl=/usr/local/httpd24/bin/apachectl

httpd=${HTTPD-/usr/local/httpd24/bin/httpd}

pidfile=${PIDFILE-/usr/local/httpd24/logs/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

chkconfig –add httpd24 ;chkconfig –list httpd24