版权声明: https://blog.csdn.net/lionkas/article/details/82352918
1、安装apache
yum install httpd
2、配置ServerName
将#ServerName www.example.com:80修改为ServerName localhost:80
vim /etc/httpd/conf/httpd.conf
3、开启防火墙,并开放80端口
systemctl start firewalld
4、开放防火墙的80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
5、重启防火墙
firewall-cmd --reload
6、查询防火墙已开放的端口
firewall-cmd --list-ports
7、启动Apache服务
systemctl start httpd
systemctl enable httpd (加入开机自启)
8、在浏览器访问Apache服务
http://localhost 或者 http://IP地址
注:CentOS7 和 6所用防火墙不同 开启apache的命令也不同