How to open a port on Centos 6 that has WHM/cPanel installed

May 28, 2014 at 6:14 pm

Firstly, forget ipTables. There’s an easier way. Install “APF”:

  1. Login as Root
  2. Go to your home folder: cd ~
  3. Make a temporary download folder: mkdir downloads
  4. Go into that folder: cd downloads
  5. Download APF: wget
  6. Go into the extract folder: cd apf-9.7-2/
  7. Run the install file: ./

You should see something similar to this:

[root@root]# ./
Installing APF 9.7-2: Completed.

Installation Details:
Install path: /etc/apf/
Config path: /etc/apf/conf.apf
Executable path: /usr/local/sbin/apf

Other Details:
Listening TCP ports: 21,22,25,53,80,110,111,143,443,465,587,631,993,995,2077,2078,2082,2083,2086,2087,2095,2096,3306,43593
Listening UDP ports: 53,111,631,745,764,58037
Note: These ports are not auto-configured; they are simply presented for information purposes. You must manually configure all port options.

APF is now installed, and you can head on over to /etc/apf/conf.apf:

  1. vi /etc/apf/conf.apf
  2. Navigate to the line that reads: # Common inbound (ingress) TCP ports
  3. Below that line, you want to add something like this: IG_TCP_CPORTS=”20,21,22,25,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,2096,3306,10000,35000_35999″
  4. Save the file and quit VIM
  5. Stop APF: service apf stop
  6. Start APF again: service apf start

You should be good to go! But, if you want to make sure APF starts on startup, do this:

  1. chkconfig –add apf
  2. chkconfig –level 345 apf on
  3. Restart Centos to make sure it works after the restart: shutdown -r now

Now you should be ready to rock!