1.安装
yum -y install httpd
![](http://dowhere.com/blog/wp-content/uploads/2019/08/image-2.png)
2.开启apache服务
systemctl start httpd.service
![](http://dowhere.com/blog/wp-content/uploads/2019/08/image-1.png)
3.设置apache服务开机启动
systemctl enable httpd.service
![](http://dowhere.com/blog/wp-content/uploads/2019/08/image-3.png)
4.验证apache服务是否安装成功
默认情况下apache的目录在/var/www/html 里面有一个默认的页面
在本机浏览器中输入虚拟机的ip地址或者输入命令 curl
curl http://localhost |
![](http://dowhere.com/blog/wp-content/uploads/2019/08/image-4.png)
5. 防火墙设置
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload |
![](http://dowhere.com/blog/wp-content/uploads/2019/08/image-5.png)
外网通过IP访问
![](http://dowhere.com/blog/wp-content/uploads/2019/08/image-6.png)
文章评论