1. 程式人生 > >linux 記一次httpd服務正常,http不能訪問的慘痛教訓

linux 記一次httpd服務正常,http不能訪問的慘痛教訓

記一次httpd服務啟動正常,http服務死活不能訪問的問題記錄。 
1.在linux下,使用ps和grep檢視httpd服務

# ps aux | grep httpd
root      7579  0.0  0.0   3872   656 pts/1    S+   17:48   0:00 grep httpd
apache   12229  0.0  0.3  32940  7108 ?        S    04:03   0:00 /usr/sbin/httpd
apache   12230  0.0  0.3  33076  7680 ?        S    04:03   0:00 /usr/sbin/httpd
apache   12231
0.0 0.3 33076 7820 ? S 04:03 0:00 /usr/sbin/httpd apache 12232 0.0 0.3 33076 7176 ? S 04:03 0:00 /usr/sbin/httpd apache 12233 0.0 0.3 33076 7984 ? S 04:03 0:00 /usr/sbin/httpd apache 12234 0.0 0.3 33076 6760 ? S 04:03 0:00 /usr/sbin/httpd apache 12235 0.0 0.3 33076 7016 ? S
04:03 0:00 /usr/sbin/httpd apache 12236 0.0 0.3 33288 8288 ? S 04:03 0:00 /usr/sbin/httpd root 18009 0.0 0.5 32804 11820 ? Ss Mar21 0:00 /usr/sbin/httpd apache 30098 0.0 0.3 33076 7000 ? S 14:59 0:00 /usr/sbin/httpd
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

沒啥說的,httpd服務已經啟動正常,如果看不到httpd,服務沒有啟動成果 
2.產看埠

netstat -anp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 12229/httpd tcp 0 0 xxx.xxx.xxx.xxx:48500 xxx.xxx.xxx.xxx:80 ESTABLISHED 1827/AliYunDun
  • 1
  • 2
  • 3

從上面看,httpd的埠80已經監聽正常,但是客戶端死活連不上,什麼情況。

3.檢視防火牆 
對於不是運維的linux工作的人,已經頭大了,只知道window玩防火牆,linux也使用防火牆?只能想到這裡了,度娘linux防火牆管理方法,得到管理命令iptables,檢視其服務開啟方法

[xxxx]#service iptables status
  • 1

如果得到是關閉狀態,恭喜你,你的問題可以像我一樣已經解決了。執行

[xxxx]#service iptables stop
  • 1

在使用http請求80埠,就該能夠使用了。