CentOS 7.0默认使用的是firewall做为防火墙,这里改成iptables防火墙。shell
### 关闭firewall: systemctl stop firewalld.service #中止firewall systemctl disable firewalld.service #禁止firewall开机启动 ### 安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #加入80端口 :wq! #保存退出 ###最后重启防火墙使配置生效 systemctl restart iptables.service ###设置防火墙开机启动 systemctl enable iptables.service