centos配置防火牆 開啟80端口
編輯配置文件/etc/sysconfig/iptables
[root@weixinht ~]# vim /etc/sysconfig/iptables 1 # Firewall configuration written by system-config-firewall 2 # Manual customization of this file is not recommended. 3 *filter 4 :INPUT ACCEPT [0:0] 5 :FORWARD ACCEPT [0:0] 6 :OUTPUT ACCEPT [0:0] 7 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 8 -A INPUT -p icmp -j ACCEPT 9 -A INPUT -i lo -j ACCEPT 10 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 11 12 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 13 14 -A INPUT -j REJECT --reject-with icmp-host-prohibited 15 -A INPUT -j REJECT --reject-with icmp-host-prohibited 16 -A FORWARD -j REJECT --reject-with icmp-host-prohibited 17 COMMIT
修改的部分: 在第10行22端口規則的下面增加 80端口規則 編輯時直接y復制一行再p粘貼, 22改為80
/etc/init.d/iptables restart
重啟防火牆使配置生效
http://xxxxxx/Linuxjc/1134231.html TechArticle