Centos7安裝httpd2.4.46


1. 安裝環境

#安裝編譯環境
yum install gcc make autoconf gcc-c++ glibc glibc-devel pcre pcre-devel expat-devel

2. 升級openssl

因為httpd2.4.46需要openssl v1.1.1版本。centos7yum倉庫的版本太老不支持

#下載openssl,解壓
 wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1h.tar.gz
tar xvf openssl-1.1.1h.tar.gz
#編譯安裝到指定目錄/app/openssl下
cd ~/openssl-1.1.1h
./config --prefix=/app/openssl
make && make install
#配置環境
echo "/app/openssl/lib/" >> /etc/ld.so.conf
ldconfig -v
echo 'export PATH=/app/openssl/bin:$PATH' > /etc/profile.d/openssl.sh
. /etc/profile.d/openssl.sh

3. 升級apr包

這也是最新版httpd的要求不然編譯的時候會報錯。

#下載apr包,解壓
wget https://mirror.dsrg.utoronto.ca/apache//apr/apr-1.7.0.tar.bz2
tar xvf apr-1.7.0.tar.bz2
cd apr-1.7.0
#編譯安裝
./configure --prefix=/usr/
make && make install

4.升級apr-util

#跟上面一下下載,解壓
wget https://mirror.dsrg.utoronto.ca/apache//apr/apr-util-1.6.1.tar.bz2
tar xvf apr-util-1.6.1.tar.bz2
#編譯安裝
./configure --prefix=/app/util --with-apr=/usr/bin/apr-1-config --enable-utf8
make && make install

5. 安裝httpd

上面的環境升級完后才可進行這一步,不然會報錯的。

#下載包,解壓
wget https://mirror.its.dal.ca/apache//httpd/httpd-2.4.46.tar.bz2
tar xvf  httpd-2.4.46.tar.bz2
cd httpd-2.4.46
#編譯安裝到/app/httpd24目錄
./configure --prefix=/app/httpd24/
make && make install

6. 配置

  • 報錯:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

解決方案:
找到#ServerName www.example.com:80 把#去掉,然后改成 ServerName 127.0.0.1:80再重啟apache即可沒事了。

7. 參考鏈接

參考鏈接
參考鏈接


免責聲明!

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



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