Fedora 12安裝之後,默認就有了httpd,如果沒有,需要到http://httpd.apache.org/手動下載,編譯。
為了本次演示,我專門卸載了原有的httpd,重新下載並安裝apache。卸載方法:yum -e httpd.
1:到apache官方網站 http://httpd.apache.org/download.cgi 下載最新版本的apache,然後解壓,執行如下命令:
./configure –prefix=/root/soft/apache
configure: error: APR not found. Please read the documentation.
2:提示缺少apr,下載http://apache.freelamp.com/apr/ ,編譯安裝完成apr之後,繼續編譯apache.
3:編譯( ./configure --prefix=/root/soft/apr-util –with-apr=/root/soft/apr)
configure: error: APR-util not found. Please read the documentation
4:缺少apr-util,下載編譯apr-util之後,繼續編譯apache
/configure --prefix=/root/soft/apache --with-apr=/root/soft/apr/ --with-apr-util=/root/soft/apr-util/
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
5:再次提示缺少pcre,下載之http://sourceforge.net/projects/pcre/ 編譯 安裝(我這裡均安裝在/root/soft目錄裡,例如./configure --prefix=/root/soft/pcre)
./configure --prefix=/root/soft/apache --with-apr=/root/soft/apr/ --with-apr-util=/root/soft/apr-util/ --with-pcre=/root/soft/pcre
6:然後就可以編譯通過了。
7:照例make ,make install,然後到/root/soft/apache/bin目錄裡,執 行./apachectl start,啟動httpd服務,在浏覽器中輸入127.0.0.1進行測試,可 以出來網頁,但是提示403 Forbidden,因為我的www目錄默認在/root/soft/apache/htdocs目錄,該目錄是root權限的目錄,web用戶是無權限訪問的,修改apache/conf/httpd.conf。把DocumentRoot 修改為 /var/www/html (可以在var下面新建這些目錄) ,同時還需要修改至,保存,執行apachectl restart,即可
8:apache在linux默認是支持ipv4/ipv6的,在浏覽器中輸入[::1],期待已久的網頁出現啦...
Enjoy It!
附:
1:在configure的時候,如果遇到缺少其他軟件,可以先看一下help,例如本次安裝過程中如果提示缺少apr,那麼
./configure –help|grep apr
2:我的apache的編譯命令:
./configure --prefix=/root/soft/apache --withpr=/root/soft/apr --with-apr-util=/root/soft/apr-util/ --with-pcre=/root/soft/pcre/ --enable-so