随笔-295  评论-26  文章-1  trackbacks-0

Centos 

辛辛苦苦编译安装完Ngnix,mysql ,PHP,后发现不能访问,后来发现是防火墙把80端口给禁用了。开启之:(以下参考自:http://llhdf.javaeye.com/blog/526176)

 
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT 
 
然后保存: 
#/etc/rc.d/init.d/iptables save 
 
再查看是否已经有了: 
[root@vcentos ~]# /etc/init.d/iptables status 
Table: filter 
Chain INPUT (policy ACCEPT) 
num  target     prot opt source               destination         
1    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:80 
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80 
3    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0           
 
Chain FORWARD (policy ACCEPT) 
num  target     prot opt source               destination         
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0
二.重启电脑。
 
1.CentOS操作系统防火墙默认已经开放了80和22端口
 
2.这里应该也可以不重启计算机:
#/etc/init.d/iptables restart
防火墙的关闭,关闭其服务即可:
 
3.查看防火墙信息:
#/etc/init.d/iptables status
 
4.关闭防火墙服务:
#/etc/init.d/iptables stop
 
三.永久关闭防火墙
 
我们也可以永久的关闭防火墙,但是我不建议大家这样做.永久关闭防火墙可以这样:
#chkconfig –level 35 iptables off
也可以直接修改
/etc/sysconfig/iptables
添加一条
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


大盘预测 国富论
posted on 2015-08-14 19:02 华梦行 阅读(415) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: