用redhat虛拟機搭建web伺服器時,能ping通,卻無法用通路web服務,這種情況大機率就是防火牆問題

首先,檢視防火牆狀态
systemctl status firewalld
法一、關閉防火牆
臨時關閉,立即生效
systemctl stop firewalld
永久關閉(重新開機也不自啟動),重新開機生效
systemctl disable firewalld
法二、配置防火牆規則
配置允許http協定通過即可
firewall-cmd --add-service=http #添加http通路
firewall-cmd --query-service=http #檢視規則是否生效
即可通路網頁
注:推薦使用法二!!!