CentOS 7.x 編譯安裝 httpd

Welcome! - The Apache HTTP Server Project

https://httpd.apache.org/


Download - The Apache HTTP Server Project

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


Nghttp2: HTTP/2 C Library - nghttp2.org

https://nghttp2.org/


nghttp2/nghttp2: nghttp2 - HTTP/2 C Library and tools

https://github.com/nghttp2/nghttp2


Releases · nghttp2/nghttp2

https://github.com/nghttp2/nghttp2/releases


下載 nghttp2
cd /usr/local/src
lynx https://github.com/nghttp2/nghttp2/releases/download/v1.39.2/nghttp2-1.39.2.tar.bz2

安裝 nghttp2
tar jxf nghttp2-1.39.2.tar.bz2
cd nghttp2-1.39.2
./configure --prefix=/usr/local/nghttp2 --with-boost
make
make check
make install
make clean

Welcome! - The Apache Portable Runtime Project

https://apr.apache.org/


Download - The Apache Portable Runtime Project

https://apr.apache.org/download.cgi


下載 apr
cd /usr/local/src
lynx http://ftp.mirror.tw/pub/apache//apr/apr-1.7.0.tar.bz2

安装 apr
tar jxf apr-1.7.0.tar.bz2
cd apr-1.7.0
./configure --prefix=/usr/local/apr
make
make check
make install
make clean

下載 apr-util
cd /usr/local/src
lynx http://ftp.mirror.tw/pub/apache//apr/apr-util-1.6.1.tar.bz2

安装 apr-util
tar jxf apr-util-1.6.1.tar.bz2
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make check
make install
make clean

下載 httpd
cd /usr/local/src
lynx http://ftp.twaren.net/Unix/Web/apache//httpd/httpd-2.4.41.tar.bz2

安裝 httpd
tar jxf httpd-2.4.41.tar.bz2
cd httpd-2.4.41
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre --enable-mods-shared=all --enable-mpms-shared=all --enable-static-support --enable-http2 --with-nghttp2=/usr/local/nghttp2
make
make install
make clean

編輯 httpd 設定檔
vi /usr/local/apache2/conf/httpd.conf
新增 http2 支援
LoadModule http2_module modules/mod_http2.so
新增 rewrite 支援
LoadModule rewrite_module modules/mod_rewrite.so
變更預設伺服器資訊
ServerAdmin
ServerName

其他設定資訊
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-default.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-ssl.conf

啟動 httpd
/usr/local/apache2/bin/apachectl start
停止 httpd
/usr/local/apache2/bin/apachectl stop
重啟 httpd
/usr/local/apache2/bin/apachectl restart
新增時間 2020-01-22
最後更新 2022-02-09