How to disable cPanel URLs How to disable cPanel URLs apache apache

How to disable cPanel URLs


Changing default cPanel port.

The cPanel port can be changed in /var/cpanel/cpanel.config file.

Just change port=2082 (located in the config file) to anything else.

Then running the following commands for the changes to take effect.

/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings/etc/init.d/httpd restart

Changing/removing default cPanel URLs.

For the /whm and /cpanel urls, remove/change these lines or similar matched lines located on the /usr/local/apache/conf/httpd.conf file:

 ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi ScriptAliasMatch ^/?webmail/?$ /usr/local/cpanel/cgi-sys/wredirect.cgi ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi

Then run the following commands for the changes to take effect.

 /usr/local/cpanel/bin/apache_conf_distiller --update /scripts/rebuildhttpdconf /etc/init.d/httpd restart

Source and more info


From a similar discussion raised on cPanel's Forums - "Changing cPanel URL?" (29 Nov 2010):

There is no way to change the port numbers for cPanel, the WebHost Manager or Webmail. The port numbers are hard-coded into cPanel and there is no configuration option that allows them to be changed.

Even if you edit the httpd.conf file and change the ScriptAlias directives that cause /cpanel, /webmail and /whm to work, they will still be accessible via ports 2082/2083, 2095/2096, and 2086/2087, respectively.

(With application, or package specific questions, your best port of call is initially their own forums/helpdesk rather than a general purpose community like StackOverflow.)


this can be easily done with TCP PORT filtering blocking.

Just filter out in iptables every 2082 (may be even 2083) TCP IN and you will have your cpanel port blocked.

You can reinstate it when needed adding an ALLOW directory to the same ports.

Please tell me if you need further help.