安裝apache曲折小記

centos5.5安裝apache的過程:

1:到apache官方網站 http://httpd.apache.org/ 下載最新版本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/apr-1-config)

configure: error: APR-util not found. Please read the documentation

4:缺少apr-util,下載編譯apr-util之後,繼續編譯apache

/configure --prefix=/root/soft/apache/apr-util/bin/apu-config  --with-apr=/root/soft/apr/bin/apr-1-config大致是這樣的

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/bin/apr-1-config --with-apr-util=/root/soft/apr-util/bin/apu-config

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下面新建這些目錄) ,同時還需要修改<Directory "/root/soft/apache/htdocs">至<Directory "/var/www/html/">,保存,執行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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章