1. 在apache.org下载httpd-2.4.7.tar.bz2

  在安装时需要以下软件,一并下载

   apr-1.5.0.tar.gz

   apr-util-1.5.3.tar.gz


2. 安装

  安装pcre:  yum install pcre  -y //需要配置yum源

 

安装apr

  tar xf apr-1.5.0.tar.gz

  cd apr-1.5.0

  ./configure

  make

  make install


安装 apr-util

  tar xf apr-util-1.5.3.tar.gz

  cd apr-util-1.5.3

  ./configure --with-apr=/usr/local/apr/bin/apr-1-config

  make

  make install


安装httpd

 tar xf httpd-2.4.7.tar.bz2

 cd httpd-2.4.7

 ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd/conf.d \
    --with-apr=/usr/local/apr/bin/apr-1-config

  make

  make install

 

3. 启动与停止

  cd /usr/local/apache/bin
  ./apachectl start |stop


4. 加入系统服务,用service命令控制启动
  grep -v "#" /usr/local/apache/bin/apachectl >/etc/init.d/apache
  vi /etc/init.d/apache
  add:  #!/bin/sh
        #chkconfig 2345 85 15

  让系统自带启动
       echo "/usr/local/apache/bin/apachectl start" >/etc/rc.local