CentOS如何开放80端口号

前端之家收集整理的这篇文章主要介绍了CentOS如何开放80端口号前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1)查看80断开是否打开(肯定没打开)

[root@centos5 conf]# iptables -L –n

Chain INPUT (policy ACCEPT)

targetprot opt sourcedestination

RH-Firewall-1-INPUT all-- 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT)

targetprot opt sourcedestination

RH-Firewall-1-INPUT all-- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)

targetprot opt sourcedestination

Chain RH-Firewall-1-INPUT (2 references)

targetprot opt sourcedestination

ACCEPTall -- 0.0.0.0/0 0.0.0.0/0

ACCEPTicmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255

ACCEPTesp -- 0.0.0.0/0 0.0.0.0/0

ACCEPTah -- 0.0.0.0/0 0.0.0.0/0

ACCEPTudp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353

ACCEPTudp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631

ACCEPTtcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631

ACCEPTall -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED

ACCEPTtcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22

REJECTall -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

2)修改文件/etc/sysconfig/iptables

[root@centos5 conf]# vim/etc/sysconfig/iptables

新增规则如下:

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

3)重启iptalbes

[root@centos5 conf]# service iptables restart

4)再次查看

Chain INPUT (policy ACCEPT)

targetprot opt sourcedestination

RH-Firewall-1-INPUT all-- 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT)

targetprot opt sourcedestination

RH-Firewall-1-INPUT all-- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)

targetprot opt sourcedestination

Chain RH-Firewall-1-INPUT (2 references)

targetprot opt sourcedestination

ACCEPTall -- 0.0.0.0/0 0.0.0.0/0

ACCEPTicmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255

ACCEPTesp -- 0.0.0.0/0 0.0.0.0/0

ACCEPTah -- 0.0.0.0/0 0.0.0.0/0

ACCEPTudp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353

ACCEPTudp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631

ACCEPTtcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631

ACCEPTall -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED

ACCEPTtcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22

ACCEPT tcp-- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80

REJECTall -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

原文链接:https://www.f2er.com/centos/378446.html

猜你在找的CentOS相关文章