Alibaba Cloud server CentOS7 firewall problems

Source: Internet
Author: User
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
  1. Systemctl start firewalld
View the firewall status:

 

 

[Html]View plain copy
  1. Systemctl status firewalld
Enable Port:

 

 

[Html]View plain copy
  1. 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
  1. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.