: This article mainly introduces how to disable and configure iptables for firewall in centos7. For more information about PHP tutorials, see. I recently played nginx as an image server. after installing it on Sentos, I found that the virtual machine could not be accessed and port 80 was not enabled.
Find a good article http://linux.it.net.cn/CentOS/fast/2015/0110/11567.html
1. configure the firewall. enable port 80 and Port 3306, and use firewall as the firewall by default. here, change it to iptables firewall. 1. disable firewall: systemctl stop firewalld. service # Stop firewallsystemctl disable firewalld. service # Disable firewall from starting Linux at startup, http: // linux.it.net. cn2. install iptables firewall yum install iptables-services # install Linux, http: // linux.it.net. cnvi/etc/sysconfig/iptables # Edit the firewall configuration file IT network, http://www.it.net.cn# Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. * filter: input accept [0: 0] Linux learning, http: // linux.it.net.cn: forward accept [0: 0] Linux learning, http: // linux.it.net.cn: output accept [0: 0] Linux learning, http: // linux.it.net.cn-a input-m state -- state ESTABLISHED, RELATED-j ACCEPT Linux learning, http: // linux.it.net.cn-a input-p icmp-j ACCEPT-A INPUT-I lo -J ACCEPT-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT Linux learning, http: // linux.it.net.cn-a input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT-A INPUT-j REJECT -- reject-with icmp-host-prohibited Linux learning, http: // linux.it.net.cn-a forward-j REJECT -- reject-with icmp-host-prohibitedCOMMIT: wq! # Save and exit systemctl restart iptables. service # Restart the firewall to make the configuration take effect. systemctl enable iptables. service # set the firewall to start up 2. disable SELINUX Linux, http: // linux.it.net. cnvi/etc/selinux/config Linux learning, http: // linux.it.net.cn # SELINUX = enforcing # Comment out # SELINUXTYPE = targeted # Comment out SELINUX = disabled # Add IT network, http://www.it.net.cn:wq ! # Save and exit setenforce 0 # Make the configuration take effect immediately
The above introduces centos7 to disable firewall to install iptables and configure it, including some content. if you are interested in the PHP Tutorial, you will be helpful.