總體來說,在ubuntu下的apache的編譯安裝還是比較容易的。
下載
apache 下載 http://httpd.apache.org/download.cgi#apache24 下載 Apache HTTP Server 2.4.9
安裝過程中如果出現要求安裝apr的錯誤提示,則需要安裝apr和apr-util
http://apr.apache.org/download.cgi 在同一個頁面下下載apr和apr-util安裝包
安裝
1、首先安裝apr
./configure
make
make test (測試make結果)
make install (該步驟會將apr安裝在/usr/local/apr中,需要root權限)
2、接着安裝apr-util
./configure --with-apr=/usr/local/apr (注意這裏需要額外指定上面apr的安裝路徑)
make
make install (同樣可能需要root權限,這裏會將apr-util安裝在/usr/local/apt/lib中)
3、最後安裝apache
./configure
make
make test
make install (同樣是需要root權限,默認安裝在/usr/local/apache2)
至此apache安裝完成,接下來開啓apache服務
/usr/local/apache2/bin/apachectl -k start (開啓服務,需要root權限)
/usr/local/apache2/bin/apachectl -k stop (停止服務,需要root權限)
測試apache是否成功開啓
在瀏覽器中輸入 http://localhost 或者 http://127.0.0.1 出現