關閉SELINUX:linux
修改/etc/selinux/config文件中的SELINUX="" 爲 disabled ,而後重啓。bash
若是不想重啓系統,使用命令#setenforce 0;tcp
關閉iptables防火牆:spa
sudo systemctl stop firewalld.service # 暫時關閉,重啓後恢復 sudo systemctl start firewalld.service # 啓用防火牆 sudo systemctl disable firewalld.service # 禁用防火牆 sudo systemctl enable firewalld.service # 啓用防火牆 sudo systemctl status firewalld.service # 查看狀態 命令配合也是控制其餘linux服務的基本方法。
或開放80端口:rest
Fedora 26/25/24 and CentOS/Red Hat (RHEL) 7.3
2.2.1 List Your Active Firewalld Zones
Bashcode
firewall-cmd --get-active-zones
Example output:ip
public interfaces: wlp1s0
2.2.2 Add New Rule to Firewalld
You might have active zone like public, FedoraWorkstation, FedoraServer.get
Bashcmd
firewall-cmd --permanent --zone=public --add-service=http ## OR ## firewall-cmd --permanent --zone=public --add-port=80/tcp
2.2.3 Restart firewalld.service
Bashit
systemctl restart firewalld.service
2.1. CentOS/Red Hat (RHEL) 6.9
2.1.1 Edit /etc/sysconfig/iptables file:
Bash
nano -w /etc/sysconfig/iptables
2.1.2 Add following INPUT rule:
Bash
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
2.1.3 Restart Iptables Firewall:
Bash
service iptables restart ## OR ## /etc/init.d/iptables restart