1. 安裝Apache組件
[root@mycentos shell]# yum install httpd
2. 安裝成功后,檢測有無httpd進程
[root@mycentos shell]# ps -e |grep httpd
3. 如沒有,啟用該服務
[root@mycentos shell]# systemctl restart httpd.service
4. 使用瀏覽器訪問本機IP地址,如果顯示鏈接失敗如下:
應該是防火牆相關設置問題導致.
5.關閉並禁用防火牆
[root@mycentos shell]# systemctl stop firewalld.service #停止防火牆服務
[root@mycentos Desktop]# systemctl disable firewalld.service #禁用防火牆開機啟動服務
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
6.再次訪問網站,能夠成功登錄

注意:如果你還是希望使用iptables來進行防火牆配置,記得一定要做下面設置:
[root@mycentos Desktop]# yum install iptables-services
[root@mycentos Desktop]# systemctl enable iptables