centos apache 安装

1、  apr-1.4.6.tar.gz

tar xzf apr-1.4.6.tar.gz

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

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/pcre

make && make install 

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

 

4、  apache

tar xzf httpd-2.4.3.tar.gz

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

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/andy24/p/3508649.html