Recently, some of my personal websites are being launched. because nodejs express framework listens to port 3000 by default, it cannot be accessed when it is changed to port 80, the CentOS7 Firewall problem is involved in troubleshooting. make a record at the next time. After Centos was upgraded to 7, it was found that iptables could not be used to control the Linuxs Port. after google, it was found that Centos7 replaced the original iptables with firewalld. The following describes how to use
Recently, some of my personal websites are being launched. because nodejs express framework listens to port 3000 by default, it cannot be accessed when it is changed to port 80, the CentOS7 Firewall problem is involved in troubleshooting. make a record at the next time.
After Centos is upgraded to 7, it finds that iptables cannot be used to control the Linuxs Port. after google finds that Centos 7 uses firewalld instead of the original iptables. The following describes how to use firewalld to open a Linux port:
Enable firewall:
[Plain]View plain copy
- Systemctl start firewalld
View the firewall status:
[Html]View plain copy
- Systemctl status firewalld
Enable Port:
[Html]View plain copy
- Firewall-cmd -- zone = public -- add-port = 80/tcp -- permanent
Command description:
-- Zone # Scope
-- Add-port = 80/tcp # add a port in the format of port/communication protocol
-- Permanent # takes effect permanently. If this parameter is not set, it becomes invalid after restart.
Restart firewall:
[Html]View plain copy
- Firewall-cmd -- reload
For more operations, refer to the answer provided by github:
Http://stackoverflow.com/questions/24729024/centos-7-open-firewall-port
The following is an introduction to firewalld:
Http://www.centoscn.com/CentOS/help/2015/0208/4667.html