linux 編譯安裝apache遇到的坑

今天裝apache,遇到好多坑,現在把它記下來,以免以后在犯錯
首先先安裝linux編譯環境
首先下載三樣東西

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.25.tar.gz
wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz
wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz

然后安裝編譯環境

yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel

解壓

tar xzvf httpd-2.4.25.tar.gz
tar xzvf apr-1.5.2.tar.gz
tar xzvf apr-util-1.5.4.tar.gz

然后編譯

 cd apr-1.5.2
 ./configure --prefix=/usr/local/apr
 make && make install
 cd apr-util-1.5.4
 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
 make && make install
cd httpd-2.4.25
 ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=most --with-mpm=event
make && make install

注意:如果這一步報錯error: MPM most does not support dynamic loading.
就把
--enable-mpms-shared=most
改成--enable-mpms-shared=all

然后啟動
先關掉防火墻

systemctl stop firewalld

在/usr/sbin/目錄下

 apachectl start

瀏覽器打開本地主機ip

Paste_Image.png
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容