首頁論壇分類作業系統LinuxCentOS 7.x 編譯安裝 httpd
CentOS 7.x 編譯安裝 httpd
   編 輯        刪 除      # 5c8224a78cc6c 發表: Odyssey     新增:2018-09-19 11:22:40     更新:2018-09-19 11:55:44

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.33.0/nghttp2-1.33.0.tar.bz2

安裝 nghttp2
tar jxf nghttp2-1.33.0.tar.bz2
cd nghttp2-1.33.0
./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.twaren.net/Unix/Web/apache//apr/apr-1.6.5.tar.bz2

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

下載 apr-util
cd /usr/local/src
lynx http://ftp.twaren.net/Unix/Web/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.34.tar.bz2

安裝 httpd 2.4.34
tar jxf httpd-2.4.34.tar.bz2
cd httpd-2.4.34
./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 --enable-ssl --with-ssl --with-curl
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

設定目錄
<Directory "/usr/local/apache2/htdocs">
    Options FollowSymLinks
</Directory>

<IfModule dir_module>
    DirectoryIndex index.htm index.html
</IfModule>

變更預設伺服器資訊
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


夢幻奧德修斯 - OdysseusDream
Website:https://www.odysseusdream.com/
Discord:https://discord.gg/ht4mwMG
FB社團:https://www.facebook.com/groups/OdysseusDream/

我要回覆
首頁論壇分類作業系統LinuxCentOS 7.x 編譯安裝 httpd