You can change the cPanel port in /var/cpanel/cpanel.config file. Search for this line:
If you change it to 3050, for example, then 3050 will work for http and 3051 will work for https for cPanel access. After changing the port, then run these two commands for it to take effect:
Code:
/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings
/etc/init.d/httpd restart
I would suggest disabling non-secure cPanel and WHM access entirely, though. You can do that in WHM > Tweak Settings > Require SSL option by having it set to "On"
For WHM, I am not aware of an option to modify the WHM port, although it might be possible to setup iptables routing rules to do so.
Finally, for the /whm and /cpanel urls, you could remove those in /usr/local/apache/conf/httpd.conf file and distill it to preserve the changes. The lines will look similar to the following:
Code:
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
At that point, run the following to have the changes updated:
Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
If you remove those options and change the cPanel port, then cPanel will only be accessible using the ports defined if proxy subdomains do not exist. If you remove the /whm option, then you will only be able to access WHM using the 2086 and 2087 ports, since those ports aren't changeable. You could, though, setup WHM > Host Access Control for whostmgrd and prevent access to WHM for any IP(s) other than your own.
I did want to mention one more point for the ScriptAliasMatch urls I mentioned above:
Code:
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
If you notice, the cPanel one uses redirect.cgi, the webmail one uses wredirect.cgi and the whm one uses whmredirect.cgi for the matching redirect. If you want to change the cpanel, webmail and whm urls, you can change them here to something else in httpd.conf and distill those changes. The only caveat is that you cannot get the cpanel one to work upon changing it if you've also changed the port number, so I simply suggest removing the cPanel redirection one if you will be changing the port number. You could, though, change the webmail and whm ones, so you end up with:
Code:
ScriptAliasMatch ^/?lisa/?$ /usr/local/cpanel/cgi-sys/wredirect.cgi
ScriptAliasMatch ^/?bart/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi
Then webmail will be available on domain.com/lisa and whm will be available on domain.com/bart instead for this example. You'd want to pick whatever works best for you.
Again, you'd then run these commands for that to take effect:
Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart