云原生第三次练习

源码编译安装httpd 2.4,提供系统服务管理脚本并测试

将 mysql-8.0.36-linux-glibc2.12-x86_64.tar.xz 上传后,安装gcc,gcc-c++,make等工具

1.下载httpd2.4 源码

2.解压下载压缩包

3.配置http

源码编译时出现了configure: checking for APR... no configure: error: APR not found. Please read the documentation.这个错误

4.创建Apache用户和组

5.将 User daemon 改为 User apache:

sed -r -i "s/^User [a-zA-Z]*/User apache/" /usr/local/httpd/conf/httpd.conf

6.将 Group daemon 改为 Group apache:

sed -r -i "s/^Group [a-zA-Z]*/Group apache/" /usr/local/httpd/conf/httpd.conf

7.将 DocumentRoot "/usr/local/httpd/htdocs" 改为 DocumentRoot "/var/www":

sed -r -i "s%^DocumentRoot \".*\"%DocumentRoot \"/var/www\"%" /usr/local/httpd/conf/httpd.conf

8.将 <Directory "/usr/local/httpd/htdocs"> 改为 <Directory "/var/www">:

sed -r -i "s%^<Directory \".*htdocs\">%<Directory \"/var/www\">%" /usr/local/httpd/conf/httpd.conf

9.确保 /var/www 目录存在

sudo mkdir -p /var/www

10.创建一个系统服务管理脚本 /etc/init.d/httpd:

sudo vi /etc/init.d/httpd 

11.赋予执行权限

12.将 httpd 服务添加到系统服务管理中,并设置开机启动

sudo chkconfig --add httpd

sudo chkconfig httpd on

13.启动httpd服务

systemctl start httpd

systemctl enable httpd

14.测试 httpd 服务是否正常运行 ,使用 curl 命令测试(本地或远程测试 ) 

15.测试httpd服务是否正常

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值