centos 开放80端口

ping 也可以通,但是就不能http访问,
检查一下端口,发现80端口被那防火墙关了,没办法,只能开启此端口,

 vi /etc/sysconfig/iptables

请在:

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

这一句上面添加一句:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

然后重启防火墙

/etc/init.d/iptables restart

相关命令

 
# 查看防火墙的状态
/etc/init.d/iptables status
# 查看80 端口是否占用   
lsof -i tcp:80
# 查看已经连接的服务端口 (ESTABLISHED)  
netstat -a
# 查看所有的服务端口(LISTEN,ESTABLISHED)  
netstat -ap
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s