Add a port for the Linux (CentOS) firewall

Source: Internet
Author: User
Tags centos server
Today, I installed a CentOS server, which is the most streamlined and has been installed in half an hour. what I need is the most basic functions. Next, I installed DirectAdmin (DA for short), but after the installation is successful, the management page cannot be opened and the problem cannot be found many times, finally, I thought that I had installed a CentOS server today. it was the most simple installation. it took half an hour to complete the installation, and I needed the most basic functions. it was perfect.

Next, I installed DirectAdmin (DA for short), but after the installation is successful, the management page cannot be opened, and the problem cannot be found many times. The last thought may be a firewall problem. After the firewall is disabled, it is okay, but it is not safe to close the firewall, so I have added several ports below. one is the port 80 required to access the website, one is the default DA Port 2222. of course, you can change the DA Management Panel access port.

In Linux, the firewall is called iptables, and the configuration file is in/etc/sysconfig. I performed the following operations in sequence:

# Vi/etc/sysconfig/iptables

Add:
The following content is the program code
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 2222-j ACCEPT


Save and restart the firewall so that the required Port is added.

Update: I did not pay special attention when writing an article. I found that the wp program has converted the two half-width-to the full-width-, so bbao mentioned this in the comment, but I didn't pay too much attention at the time. today, I noticed it when my buddy ppopcn said me. I am sorry here and have corrected it.
 
Related Article

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.