源码编译安装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服务是否正常