apache安装与配置出了yum
2025-03-18 10:20:09
66
参考资料
apache安装与配置出了yum
安装Apache:
sudo yum install httpd
启动Apache服务:
sudo systemctl start httpd
设置Apache开机自启动:
sudo systemctl enable httpd
配置防火墙允许HTTP和HTTPS流量:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
验证Apache是否运行:
打开浏览器,访问http://your_server_ip
,如果看到Apache默认页面,说明安装成功。配置文件位置:
主配置文件:/etc/httpd/conf/httpd.conf
额外配置文件目录:/etc/httpd/conf.d/
修改配置文件后,重启Apache服务:
sudo systemctl restart httpd
检查配置文件语法:
sudo apachectl configtest