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

linux 编译安装apache遇到的坑_第1张图片
Paste_Image.png

你可能感兴趣的:(linux 编译安装apache遇到的坑)