Press "Enter" to skip to content

RedHat5.5安装Apache2.4.3

一直听说Apache2.4版本有了重大更新,比如速度上超越了nginx等等。所以今天来装一遍试试。在安装过程中参考了这篇文章,但还是遇到些错误,现在记录一下。本文所有的软件可以在这里下载。

1,安装基础包

yum install gcc gcc-c++ zlib zlib-devel openssl openssl-devel libtool -y

2,安装pcre

cd pcre-8.20
./configure --prefix=/usr/local/pcre && make && make install

3,安装http 2.4.3

编译必须把 apr,apr-util 的源文件放到 apache2.4.3 源码的 srclib 目录下,并修改 apr 源码目录为apr,apr-util 源码目录为 apr-util

cp -rf apr-1.4.6 ./httpd-2.4.3/srclib/apr
cp -rf apr-util-1.5.1 ./httpd-2.4.3/srclib/apr-util

cd httpd-2.4.3

./configure  --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-ssl --with-ssl=/usr/local/openssl/ --enable-rewrite --enable-so --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-included-apr

make 
make install

可能出现的错误:
(1)make 时出现server/.libs/libmain.a(exports.o):(.data+0xcfc): undefined reference to `apr_os_uuid_get’
解决办法:

cd srclib/apr; make
cd srclib/apr-util; make

再退回 apache 的源码目录重新 make

4,优化apache

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd           #编辑此服务,将前三行修改为
    #!/bin/bash
    # chkconfig: 35 85 15
    # description:Apache httpd
service httpd restart
chkconfig --add httpd
chkconfig --level 35 httpd on

One Comment

  1. 一号站长 2013-02-06

    感觉对于小网站而言,估计apache和nginx没啥区别,大网站可能有区别

Leave a Reply

Your email address will not be published. Required fields are marked *