您的位置:首页 > 运维架构 > Nginx

centos7搭建完nginx后禁用firewall防火墙和selinux

2017-10-15 23:34 651 查看

禁用firewall防火墙

firewall-cmd –state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

启用iptables防火墙

安装iptables服务,yum -y install iptables-services

编辑iptables防火墙配置文件,开启80端口的访问权限,在

-A INPUT -p tcp -m state --state NEW -m tcp--dport 22 -j ACCEPT
行的上面或者下面添加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -jACCEPT


systemctl restart iptables.service #最后重启防火墙使配置生效

systemctl enable iptables.service #设置防火墙开机启动

禁用selinux

查看状态

[root@centos7 nginx]# getenforce

Enforcing


临时关闭 setenforce 0

临时开启 setenforce 1

永久关闭 vi /etc/selinux/config 修改SELINUX=disabled

重启系统

再次查看状态 sestatus或者getenforce
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息