编译安装httpd-2.4.46

安装前准备:关闭防火墙和selinux

1.安装相关的包

[root@y_zilong ~]# yum install -y gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config

2.下载并解压包

[root@y_zilong ~]# wget https://mirrors.bfsu.edu.cn/apache//httpd/httpd-2.4.46.tar.gz

3.配置

[root@y_zilong ~]# tar xvf httpd-2.4.46.tar.gz -C /usr/local/src

4.编译并安装

[root@y_zilong ~]# cd /usr/local/src/httpd-2.4.46/
[root@y_zilong httpd-2.4.46]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable--ssl
[root@y_zilong httpd-2.4.46]# make && make install

5.配置环境

[root@y_zilong httpd-2.4.46]# echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[root@y_zilong httpd-2.4.46]# . /etc/profile.d/httpd.sh

6.运行

[root@y_zilong httpd-2.4.46]#apache start

7.指定用apache用户运行

[root@y_zilong httpd-2.4.46]# useradd -r -s /sbin/nologin -d /var/www -c Apache -u 48 apache
[root@y_zilong ~]# vi /etc/httpd/httpd.conf
更改用户和组
User apache
Group apache

8.配置生效和验证

[root@y_zilong ~]# apachectl restart

9.查看进程和版本

[root@y_zilong ~]# ps -aux
apache    21759  0.0  0.0 456056  4440 ?        Sl   05:13   0:00 /apps/httpd/bin/httpd -k restart
apache    21760  0.0  0.0 456056  4448 ?        Sl   05:13   0:00 /apps/httpd/bin/httpd -k restart
apache    21761  0.0  0.0 456056  4452 ?        Sl   05:13   0:00 /apps/httpd/bin/httpd -k restart
[root@y_zilong ~]# apachectl -v
Server version: Apache/2.4.46 (Unix)
Server built:   Apr  8 2021 05:09:02
[root@y_zilong ~]# 

10.用浏览器打开IP地址,会出现It works!

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

y_zilong

一分钱的肯定

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值