Ubuntu 16.04安裝httpd


1.下載httpd源碼(當前版本為2.4.37)

http://httpd.apache.org/download.cgi

2.解壓編譯

tar -zxf httpd-2.4.37.tar.gz
cd httpd-2.4.37
./configure --prefix=/usr/local/apache2

如果出現報錯 error: APR not found,則需要安裝下面的依賴庫

 

3.依賴庫

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
tar -zxf apr-1.4.5.tar.gz cd apr-1.4.5 ./configure --prefix=/usr/local/apr make && make install

wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
tar -zxf apr-util-1.3.12.tar.gz cd apr-util-1.3.12 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install

wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
unzip -o pcre-8.10.zip cd pcre-8.10 ./configure --prefix=/usr/local/pcre make && make install

 

4.編譯

cd httpd-2.4.37 ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-ssl --with-ssl=/usr/local/openssl make && make install

 

5.如果報以下錯誤

checking for OpenSSL version >= 0.9.7… FAILED configure: WARNING: OpenSSL version is too old no checking whether to enable mod_ssl… configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

則解決辦法為:

apt-get install openssl apt-get install libssl-dev

 

6.檢驗是否安裝成功

①啟動httpd

/usr/local/httpd/bin ./httpd -k start

②使用瀏覽器打開對應地址,顯示如下表示成功。

 

以上。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM