1.下載httpd-2.4.7.tar.gz
[root@gyf soft]# wget http://apache.dataguru.cn//httpd/httpd-2.4.7.tar.gz
2.解壓
[root@gyf soft]# tar xvf httpd-2.4.7.tar.gz
[root@gyf soft]# cd httpd-2.4.7
[root@gyf httpd-2.4.7]# vim INSTALL
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
3.編譯安裝apr
[root@gyf soft]# wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.0.tar.gz
[root@gyf soft]# cd apr-1.5.0
[root@gyf apr-1.5.0]# ./configure --prefix=/etc/apr
[root@gyf apr-1.5.0]#make && make install
4.編譯安裝apr-util
[root@gyf soft]# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.3.tar.gz
[root@gyf soft]# cd apr-util-1.5.3
[root@gyf soft]#./configure --prefix=/etc/apr-util --with-apr=/etc/apr
[root@gyf soft]#make && make install
5.編譯安裝httpd
[root@gyf httpd-2.4.7]# ./configure --prefix=/usr/local/httpd --sysconfdir=/usr/local/httpd/conf/ --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mpms-shared=all --with-apr=/etc/apr --with-apr-util=/etc/apr-util
[root@gyf httpd-2.4.7]#make && make install
--prefix= :指定安裝目標路徑
--sysconfdir= :指定配置文件安裝位置
--enable-so :支持動態共享模塊,若是沒有這個模塊PHP將沒法與apache結合工做
--enable-rewirte :支持URL重寫
--enable-ssl :啓用支持ssl
--enable-cgi :啓用支持cgi
--enable-cgid :啓用支持帶線狀圖形的CGI腳本 MPMs
--enable-modules=most :安裝大多數模塊
--enable-modules-shared=most :安裝大多數共享模塊
--enable-mpms-shared=all :支持所有多道處理方式
--with-apr=/etc/apr :指定apr路徑
--with-apr-util=/etc/apr-util :指定apr-util路徑
6.apache自啓動
#cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd #把apache加入到系統啓動
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
#!/bin/sh
#chkconfig:2345 10 90
#descrption:Activates/Deactivates Apache Web Server
chmod +x /etc/init.d/httpd
chkconfig --add httpd
/etc/init.d/httpd start
#設置開機啓動
chkconfig httpd on
apache