This article will explain how you can open ports for your server in CSF through WHM and SSH.
Please be aware that opening ports on your server can be a security risk, please be aware of any risks when opening a specific port on your server.
There are 2 different ways to open ports on your server. One way is through WHM and one is via command line.
Steps to open ports in WHM
- Log in to your WHM:
SERVER-IP/WHM
orSERVER-IP:2087
- Click “
ConfigServer Security & Firewall
,” which is under the “Plugins” section - Go to “
Firewall Configuration
” - Find “
TCP_IN=
” under “IPv4 Port Settings” - Enter the port number in the list below. Make sure to separate ports with a single comma and do not enter any spaces.
- Click “
Change
” at the bottom of the page.
This will reset the firewall so that the ports that you have opened will take effect.
Steps to open ports via command line
- SSH into your server.
- Go to the directory with the CSF configuration file.
cd /etc/csf/
- Open the file “csf.conf” (In this tutorial I used “nano” editor)
nano csf.conf
- Once you are in the configuration file, find “
TCP_IN=
“, it will be under “# Allow incoming TCP ports
“ - Within the quotation marks, put the port number that you wish to open. Separate each IP using a single comma and no spaces.
- Close the file and save all changes.
- Restart the firewall.
csf -r