CentOS安装Apache

先去网上下载四个文件

1、apr-1.4.6.tar.gz

2、apr-util-1.5.1.tar.gz

3、pcre-8.32.tar.gz

4、httpd-2.4.3.tar.gz

这些都是安装Apache必须的文件,而且很好下载。

http://pan.baidu.com/share/link?shareid=169366&uk=1829018343

这个是我上传的,截至到2013-01-10日这些文件都是最新的版本

1、  apr-1.4.6.tar.gz

tar xzf apr-1.4.6.tar.gz

./configure --prefix=/usr/local/apr

(如果上面安装过程出现/bin/rm: cannot remove `libtoolT’: No such file or directory这个问题,解决办法 vi configure 找到$RM “$cfgfile”这行删掉)

make && make install

2、  apr-util-1.5.1.tar.gz

tar xzf apr-util-1.5.1.tar.gz

./configure --with-apr=/usr/local/apr

make && make install

 

3、  prce

tar xzf pcre-8.32.tar.gz

./configure --prefix=/usr/local/prce

make && make install 

 

4、  apache

tar xzf httpd-2.4.3.tar.gz

./configure -prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-pcre=/usr/local/prce/

make && make install

检查一下apache是否正确安装

/usr/local/apache/bin/apachectl -t

(出现AH00557: httpd: apr_sockaddr_info_get() failed for Chunk3这个问题,解决办法, vi /usr/local/apache/conf/httpd.conf 找到#ServerName www.example.com:80 这行,把注释拿掉,然后改成ServerName localhost:80)

启动apache

 service httpd start

(出现httpd: unrecognized service这个问题,解决办法

         #cd /usr/local/apache/bin/

         #cp apachectl /etc/rc.d/init.d/httpd

         #vi /etc/rc.d/init.d/httpd

         在#!/bin/sh这行下增加

         # chkconfig: 2345 50 90

         # description:Activates/Deactivates Apache Web Server)

原文地址:https://www.cnblogs.com/kgdxpr/p/2856033.html