yum -y install wget
mkdir /opt/httpd24
#下载源码
cd /opt/httpd24 && wget https://downloads.apache.org/httpd/httpd-2.4.58.tar.gz
#解压
tar -xvzf httpd-2.4.58.tar.gz -C /opt/httpd24
#下载依赖包
wget https://downloads.apache.org/apr/apr-1.7.4.tar.gz
wget https://downloads.apache.org/apr/apr-util-1.6.3.tar.gz --no-check-certificate
#解压
tar -xvzf apr-1.7.4.tar.gz -C /opt/httpd24
tar -xvzf apr-util-1.6.3.tar.gz -C /opt/httpd24
#建立整体目录
\cp -arf /opt/httpd24/apr-1.7.4 /opt/httpd24/httpd-2.4.58/srclib/apr
\cp -arf /opt/httpd24/apr-util-1.6.3 /opt/httpd24/httpd-2.4.58/srclib/apr-util
#编译所需依赖工具
yum -y install gcc make pcre-devel openssl-devel expat-devel
#安装目录
mkdir /usr/httpd24
cd /opt/httpd24/httpd-2.4.58
#配置编译
./configure --prefix=/usr/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite -with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
#编译
make && make install
#修改配置文件
sed -i '203s/.*/ServerName localhost:80/g' /usr/httpd24/conf/httpd.conf
#启动
/usr/httpd24/bin/apachectl start
#关闭防火墙
systemctl disable --now firewalld
echo "http://192.168.1.124"
Apache2.4部署命令
最新推荐文章于 2024-11-18 21:05:40 发布