本文使用软件:

Red Hat Enterprise Linux 6.6  httpd-2.4.20


第一:Apache 安装  :

下载Apache安装包和依赖包

http://mirrors.hust.edu.cn/apache//httpd/   httpd-2.4.20.tar.gz
http://apr.apache.org/download.cgi  apr-1.5.2.tar.gz   apr-util-1.5.4.tar.gz apr-iconv-1.2.1.tar.gz
http://exim.mirror.fr/pcre/    pcre-8.38.tar.gz
http://www.zlib.net   zlib-1.2.8.tar.gz        

      

(1) 安装apr
tar -zxvf apr-1.5.2.tar.gz
 ./configure --prefix=/usr/local/apr
make
make install

(2) 安装apr-iconv
tar -zxvf apr-iconv-1.2.1.tar.gz
./configure --prefix=/usr/local/apr-iconv/ --with-apr=/usr/local/apr
make
make install

(3)、安装apr-util

tar -zxvf apr-util-1.5.4.tar.gz
# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr --with-apr-iconv=/usr/local/apr-iconv/bin/apriconv
# make
# make install
(4) 安装 pcre
# tar -zxvf pcre-8.38.tar.gz
# ./configure --prefix=/usr/local/pcre
# make
# make install

(5)
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib/
make
make install


(6) 安装apache
tar -zxvf httpd-2.4.20.tar.gz
cd httpd-2.4.20

./configure --prefix=/usr/local/apache2  --enable-ssl --enable-rewrite --enable-so --enable-headers --enable-expires --with-mpm=worker --enable-modules=most --enable-deflate --with-z=/usr/local/zlib/ --with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util/  --with-pcre=/usr/local/pcre/ --enable-ssl
make
make install


vi /usr/local/apache2/conf/httpd.conf
ServerName localhost:80
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

配置开机启动
echo "/usr/local/apache2/bin/apachectl start">>/etc/rc.local

cp /usr/local/apache2/bin/httpd /etc/init.d/
chmod a+x /etc/init.d/httpd

配置环境变量
vi ~/.bash_profile
    PATH=$PATH:$HOME/bin:/usr/local/apache2/bin
    export PATH

 source ~/.bash_profile


验证:

/usr/local/apache2/bin/apachectl start  启动apache

在浏览器中输入http://localhost  

显示:IT works  说明apache部署正常