1 cd /usr/local
2 wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.10.tar.gz
3 tar zxvf ./httpd-2.4.10.tar.gz
4 wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.1.tar.gz
5 wget http://apache.fayea.com/apache-mirror//apr/apr-util-1.5.4.tar.gz
6 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
7 makedir apache
8 tar zxvf apr-1.5.1.tar.gz
9 tar zxvf apr-util-1.5.4.tar.gz
10 cp -rf ./apr-1.5.1/ ./httpd-2.4.10/srclib/
11 cp -rf ./apr-util-1.5.4/ ./httpd-2.4.10/srclib/
12 tar zxvf pcre-8.35.tar.gz
13 cd httpd-2.4.10/srclib
14 mv -f apr-1.5.1/ ./apr
15 mv -f apr-util-1.5.4/ ./apr-util
16 cd /usr/local/pcre-8.35
17 ./configure –prefix=/usr/local/pcre
18 make
19 make install
20 cd /usr/local/httpd-2.4.10
21 ./configure –prefix=/usr/local/apache/ –with-included-apr –with-pcre=/usr/local/pcre
22 make
23 make install
24 cd /usr/local/apache/conf
25 vi httpd.conf
26修改
#ServerName www.example.com:80
ServerName localhost:80
修改
Options Indexes FollowSymLinks
为
Options FollowSymLinks
修改
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
为
<IfModule dir_module>
DirectoryIndex index.html
DirectoryIndex index.php
</IfModule>
27 cd /usr/local/apache/bin
28 ./apachectl start
29 打开浏览器 输入localhost
30 浏览器展示 it works
31 安装完成
32 vi /etc/sysconfig/iptables
33 在其中加入 -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
34 service iptables save
35 service iptables restart