How to disable cPanel URLs

I use cPanel to host my site. I noticed that if someone who visits my site turns out to be a web developer, he can always get to the cPanel login page via mydomain.com:2082 , mydomain.com/cpanel , etc. It’s better not to let visitors know which control panel I'm using. I want to disable these urls. Log in to cpanel for yourself, I will use the alternative URL provided by my web host, something like a.myhost.com/cpanel .

As a job, I also changed the primary domain and added my primary site as the addon domain. But even that didn't work, and addondomain.com:2082 and addondomain.com/cpanel got cpanel login, and I was able to log in using cpanel username and password.

Please help me hide these pages from the public world. At least addondomain.com:2082 or addondomain.com/cpanel should throw 404 (preferred) or 403 or anything else.

I am using cPanel 11 / x3.

Even my hosting provider cannot help me. Anyone who knows anything about this or accomplishes this, please help me.

Thanks in advance....

+4
source share
9 answers

Change the default port of cPanel.

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

Just change port = 2082 (located in the configuration file) to something else.

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

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

Change / delete cPanel default URLs.

For the / whm and / cpanel URLs, delete / change these lines or similar lines located in 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 change to take effect.

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

Source and additional information

+8
source

From a similar discussion raised on cPanel forums - "Changing the cPanel URL?" (November 29, 2010) :

Cannot change port numbers for cPanel, WebHost Manager, or Webmail. Port numbers are hardcoded in cPanel, and there is no configuration option that allows you to change them.

Even if you edit the httpd.conf file and change the ScriptAlias ​​directives that call / cpanel, / webmail and / whm, they will still be available on ports 2082/2083, 2095/2096 and 2086/2087, respectively.

(With questions about the app or package, your best calling port is initially your own forum / support, not a general purpose community like StackOverflow.)

+3
source

this can easily be done with TCP PORT filtering lock.

Just filter in iptables every 2082 (maybe even 2083) TCP IN, and your cpanel port will be blocked.

You can restore it if necessary by adding the ALLOW directory to the same ports.

Please tell me if you need more help.

+2
source

Sometimes you want to disable automatic SSL connection when accessing WHM, cPanel, Webmail, so that you can access cPanel / WHM through the standard ports 2082 and 2086, this is very useful if you have an SSL problem that prevents you from logging in to your server or cPanel account because it will not be able to decrypt your saved password.

Logging into WHM β†’ Configuring Settings β†’ Uncheck the following options in the Redirection section

Always redirect users to ssl / tls ports when visiting / cpanel, / webmail, etc.

You should also disable the following option in the "Security Settings in Settings" section.

Require SSL for all remote logins for cPanel, WHM and Webmail. This option is recommended.

If you cannot log into the WHM server, you can disable these options from the shell. SSH to the server with root privileges.

SSH to your server with root privileges

Open

# nano /var/cpanel/cpanel.config and set the following parameters: 0 (zero).

 alwaysredirecttossl requiressl 

-

 alwaysredirecttossl=0 requiressl=0 

-

Save the file and exit.

+2
source
  • Log in to WHM as root
  • In server configuration
  • Click "Settings"
  • Go to the Redirects tab
  • Disable button for "Always redirect to SSL"
  • save the settings and it will be done
+1
source

Can't you use cpanel to redirect to the / cpanel directory? Not sure how to get around 2082 without additional privileges. Perhaps your htaccess?

But really, relax on cpanel. Nobody cares about making your life easier using cpanel. Most people do it. The only people who are going to know are, as you say, developers. And guess that they also use CPanel.

0
source

If your hosting provider cannot handle this, you're out of luck. It is recommended that you install the .htaccess rule to redirect / cpanel to your home page.

For your .htaccess:

 Redirect /cpanel / 

or if he fails,

 Redirect /cpanel http://your-site.com 
0
source

I assume you are in a collaborative hosting environment. It is best to use the htaccess file, be careful! the goal is to redirect any thing, for example: #http: //your-site.tld/cpanel or to #http: //your-site.tld, but not redirect #http: //your-provider.tld/cpanle

RedirectMatch 301 ^ / cpanel / $ http: //your-site.tld/

RewriteEngine On RewriteCond% {SERVER_PORT}! ^ 2082 $ RewriteRule ^ (. *) $ Http: //your-site.tld/folder/ $ 1 [L, R]

As I said, check carefully!

0
source

I have the exact opposite problem, I just linked my mtkroms.com domain to my blogger site, but whenever I try to access mywebsite.com/cpanel, it redirects to my blogger blog with 404 page that was not found: (because of this I cannot configure subdirectories

-one
source

Source: https://habr.com/ru/post/1394333/


All Articles