编译安装http2.4,实现可以正常访问

#1 安装相关包
[15:51:32 root@centos8 ~]#dnf install gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config -y

#2 下载并解压包
[15:53:11 root@centos8 ~]#wget https://archive.apache.org/dist/httpd/httpd-2.4.46.tar.bz2
[15:55:34 root@centos8 ~]#tar -xvf httpd-2.4.46.tar.bz2 -C /usr/local/src/

#3 配置
[15:56:37 root@centos8 src]#cd /usr/local/src/httpd-2.4.46/
[16:00:04 root@centos8 httpd-2.4.46]#./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl

#4 编译并安装
[16:00:39 root@centos8 httpd-2.4.46]#make -j 2 && make install

#5 配置环境变量
[16:03:25 root@centos8 httpd-2.4.46]#echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[16:03:50 root@centos8 httpd-2.4.46]#. /etc/profile.d/httpd.sh

#6 启动
[16:03:58 root@centos8 httpd-2.4.46]#apachectl start

#7 指定apache用户运行
[16:04:16 root@centos8 httpd-2.4.46]#useradd -r -s /sbin/nologin -d /var/www -c Apache -u 48 apache
[16:04:38 root@centos8 httpd-2.4.46]#vim /etc/httpd/httpd.conf
User apache
Group apache

#8 配置生效
[16:08:51 root@centos8 httpd-2.4.46]#apachectl restart
[16:09:06 root@centos8 httpd-2.4.46]#ps aux |grep apache
apache    119719  0.0  0.3 1339488 7688 ?       Sl   16:08   0:00 /apps/httpd/bin/httpd -k start
apache    119720  0.0  0.4 1339488 9728 ?       Sl   16:08   0:00 /apps/httpd/bin/httpd -k start
apache    119721  0.0  0.6 1339488 13808 ?       Sl   16:08   0:00 /apps/httpd/bin/httpd -k start

#9 验证网页
[16:09:10 root@centos8 httpd-2.4.46]#curl localhost
<html><body><h1>It works!</h1></body></html>


posted @   小糊涂90  阅读(14)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
点击右上角即可分享
微信分享提示