[5] 编译安装Apache-2.4.3
# cd /usr/software
# wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.4.3.tar.gz
# wget http://mirrors.axint.net/apache/apr/apr-1.4.6.tar.gz
# wget http://mirrors.axint.net/apache/apr/apr-util-1.5.1.tar.gz
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
# tar zxvf pcre-8.31.tar.gz
# tar zxvf apr-1.4.6.tar.gz
# tar zxvf apr-util-1.5.1.tar.gz
# tar zxvf httpd-2.4.3.tar.gz
# cd pcre-8.31
# ./configure --prefix=/usr/local/pcre
# make && make install
# yum -y install openssl-devel
# cd /usr/software
# cp -r /usr/software/apr-1.4.6 /usr/software/httpd-2.4.3/srclib/apr
# cp -r /usr/software/apr-util-1.5.1 /usr/software/httpd-2.4.3/srclib/apr-util
# cd httpd-2.4.3
# ./configure --prefix=/usr/local/apache \
--enable-dav \
--enable-so \
--enable-maintainer-mode \
--enable-rewrite \
--enable-deflate=shared \
--enable-ssl=shared \
--enable-expires=shared \
--enable-headers=shared \
--enable-static-support \
--with-included-apr \
--with-mpm=prefork \
--enable-cache \
--enable-file-cache \
--with-pcre=/usr/local/pcre
# make && make install
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
# vi /etc/init.d/httpd
在#!/bin/sh 下面加上这两行
# chkconfig: 345 90 90
# description: Apache
:wq
# chkconfig --add httpd
# chkconfig httpd on
# service httpd start
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
:wq
# service iptables restart
# vi /usr/local/apache/conf/httpd.conf
ServerName localhost:80
User www
Group www
:wq
# groupadd www
# useradd www -g www -s /sbin/nologin
# service httpd restart
# /usr/local/apache/bin/httpd -v
# /usr/local/apache/bin/httpd -M
至此apache安装结束。