Skip to main content

Comments

28 comments

  • Eminds
    are you on a dedicated server with root access or in a shared hosting environment ?
    0
  • Samet Chan
    are you on a dedicated server with root access or in a shared hosting environment ?

    I'm on VPS Server for self-managed. It's fully root access. Anyone still knows there?
    0
  • cPanelMichael
    Hello, The instructions in the links you provided were intended for systems using EasyApache 3. With EasyApache 4, you'd have to follow the instructions below: 1. Copy the Apache 2.4 template for EasyApache 4 to allow for customization:
    cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
    2. Edit /var/cpanel/templates/apache2_4/ea4_main.local to change the entries to match your preferences:
    vi /var/cpanel/templates/apache2_4/ea4_main.local
    For instance, if you wanted to disable the /cpanel alias, you'd remove this line when editing the file:
    ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
    3. Rebuild the Apache configuration file:
    /scripts/rebuildhttpdconf
    Keep in mind the ".local" template takes precedence over the ".default" template. You will have to manually update the ".local" template every time a new default template is issued. As of cPanel 64.0.19, notifications are sent when the EA4 default templates are updated and a local template file exists: Fixed case CPANEL-12933: Notify admins of EA4 template changes if .local versions exist. Thank you.
    0
  • Samet Chan
    Thank you! I'm on EA4 and v66.0.14 current version. 1,2 number question. Is it on SSH for root access right? Or SFTP. Answer another my two question, 2.
    cp -a /var/cpanel/templates/apache2_4/ea4_main.default [root@x ~]# cp -a /var/cpanel/templates/apache2_4/ea4_main.default cp: missing destination file operand after "/var/cpanel/templates/apache2_4/ea4_main.default" Try 'cp --help' for more information.
    Looks like are not working command line.
    0
  • cPanelMichael
    ,2 number question. Is it on SSH for root access right? Or SFTP.

    You'd use SSH as "root" with these instructions.
    Looks like are not working command line.

    That's not the full command referenced in my response. It's:
    cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
    Thank you.
    0
  • Samet Chan

    ScriptAliasMatch ^/?controlpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi ScriptAliasMatch ^/?kpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi ScriptAliasMatch ^/?securecontrolpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi ScriptAliasMatch ^/?securecpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi ScriptAliasMatch ^/?securewhm/?$ /usr/local/cpanel/cgi-sys/swhmredirect.cgi ScriptAliasMatch ^/?webmail$ /usr/local/cpanel/cgi-sys/wredirect.cgi ScriptAliasMatch ^/?webmail/ /usr/local/cpanel/cgi-sys/wredirect.cgi ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi [% IF autodiscover_proxy_subdomains -%] ScriptAliasMatch ^/Autodiscover/Autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi ScriptAliasMatch ^/autodiscover/autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi [% END -%] Alias /bandwidth /usr/local/bandmin/htdocs/ Alias /img-sys /usr/local/cpanel/img-sys/ Alias /java-sys /usr/local/cpanel/java-sys/ Alias /mailman/archives /usr/local/cpanel/3rdparty/mailman/archives/public/ Alias /pipermail /usr/local/cpanel/3rdparty/mailman/archives/public/ Alias /sys_cpanel /usr/local/cpanel/sys_cpanel/ ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/ ScriptAlias /mailman /usr/local/cpanel/3rdparty/mailman/cgi-bin/ [% IF file_test('f', '/usr/local/cpanel/cgi-sys/scgiwrap') %]ScriptAlias /scgi-bin /usr/local/cpanel/cgi-sys/scgiwrap[% END %]
    1. Can I remove WHM and cPanel, Webmail? 2. But What about kPanel?
    0
  • cPanelMichael
    Hello, You can remove any of those "ScriptAliasMatch" if you want to disable the use of those aliases. Thank you.
    0
  • Samet Chan
    Hello, You can remove any of those "ScriptAliasMatch" if you want to disable the use of those aliases. Thank you.

    Also, Can I remove autodiscover Proxy_domains too? I can't enter "Backspace" remove of lines in SSH for vi, Possible for nano?
    0
  • cPanelMichael
    I can't enter "Backspace" remove of lines in SSH for vi, Possible for nano?

    You can use the text editor of your preference (e.g. nano, vim).
    Also, Can I remove autodiscover Proxy_domains too?

    Yes, but keep in mind that will prevent the use of the autodiscover subdomain. Thank you.
    0
  • Samet Chan
    Alright, Also I'll use SFTP to edit that file? Or just only on SSH nano?
    0
  • cPanelMichael
    New Alright, Also I'll use SFTP to edit that file? Or just only on SSH nano?

    Yes, you could download the file via SFTP, edit it, and then upload the new copy. Thank you.
    0
  • Samet Chan
    Yes, you could download the file via SFTP, edit it, and then upload the new copy. Thank you.

    Doesn't work. I removed lines then restarted httpd.conf say OK. I checked site.com/cpanel and whm still up.
    [root@x ~]# /scripts/rebuildhttpdconf Built /etc/apache2/conf/httpd.conf OK
    0
  • cPanelMichael
    I checked site.com/cpanel and whm still up.

    Try clearing your browser cache or testing from another browser to make sure you are not visiting a cached URL. Thank you.
    0
  • Samet Chan
    I cleared cache browser said still WHM and cPanel up. I'll use chrome incognito said same too. Another I'll use Firefox browser said same too.
    0
  • cPanelMichael
    Doesn't work. I removed lines then restarted httpd.conf say OK. I checked site.com/cpanel and whm still up.

    This is working well on a test server. It's possible you made some incorrect changes to the ea4_main.local file. Could you open the /var/cpanel/templates/apache2_4/ea4_main.local file on the server using the "vi" command? EX:
    vi /var/cpanel/templates/apache2_4/ea4_main.local
    Does it look formatted correctly? You will sometimes face encoding issues when editing a file on a Windows-based machine and then uploading it directly via SFTP. Thank you.
    0
  • Samet Chan
    This is working well on a test server. It's possible you made some incorrect changes to the ea4_main.local file. Could you open the /var/cpanel/templates/apache2_4/ea4_main.local file on the server using the "vi" command? EX:
    vi /var/cpanel/templates/apache2_4/ea4_main.local
    Does it look formatted correctly? You will sometimes face encoding issues when editing a file on a Windows-based machine and then uploading it directly via SFTP. Thank you.

    I did just nano from SSH has saved file then httpd.conf is restarted but nothing.
    0
  • cPanelMichael
    Feel free to open a support ticket using the link in my signature if you'd like us to take a closer look to see why it's not working. Thank you.
    0
  • Samet Chan
    Support ticket ID: 8806225
    0
  • Samet Chan
    It is fixed! Thanks to cPanel support! [QUOTE="Michael B"> Hello, 1. It looks like CloudFlare may have been caching the cPanel redirect. I temporarily stopped Apache to force CloudFlare to update which page it loads when you access /cpanel and after clearing my browser cache I am no longer being redirected to the cPanel login page when loading " I have attached screenshots of what I am seeing on my end. Could you try clearing your browser cache and or using an alternate browser that has not visted the above URL to see if you are still being redirected. If you are still being redirected please try enabling CloudFlare's developer mode which disabled caching and see if that resolves your issue. Regards, -- Michael B. Linux Technical Analyst cPanel, Inc. Join us for the 2017 cPanel Conference! Sept. 26th & 27th in Fort Lauderdale, Fl. cPanel Conference | cPanel & WHM 2. There are no rewrites to handle the "/whm" script alias match in Apache's configuration and I'm not able to replicate the page still redirecting to WHM's login page as seen in my provided screenshot: ===== # grep -i scriptalias !$ grep -i scriptalias /etc/apache2/conf/httpd.conf ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/ ScriptAlias /mailman /usr/local/cpanel/3rdparty/mailman/cgi-bin/ ===== I suspect you are still cached in some way on your end. Could you try loading the WHM URL on another device? 3. I would recommend keeping the "/cgi-sys" script alias match as that directory contains a number of cPanel CGI scripts such as the suspended account page and the default error page for misconfigured domains.
    [QUOTE="Sametto Chan"> 1. Please visit this: Remove domain.com/cPanel & WHM URL 2. Thank you very much helpfully!! It worked now. I use from chrome incognito. But, what is about cgi-sys? ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/ 3. Okay, Thanks for the info. You can solve this support ticket. And I will update on thread too.
    0
  • Dionisios S. Mpolanis
    Hello guys , First of all very nice article, it helped a lot, By using the instructions i managed to remove the mydomain.com/cpanel and etc . But the cpanel.mydomain.com was not removed even when i removed all the Aliases
    # # ScriptAliasMatch ^/?controlpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi # ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi # ScriptAliasMatch ^/?kpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi # ScriptAliasMatch ^/?securecontrolpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi # ScriptAliasMatch ^/?securecpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi # ScriptAliasMatch ^/?securewhm/?$ /usr/local/cpanel/cgi-sys/swhmredirect.cgi # ScriptAliasMatch ^/?webmail$ /usr/local/cpanel/cgi-sys/wredirect.cgi # ScriptAliasMatch ^/?webmail/ /usr/local/cpanel/cgi-sys/wredirect.cgi # ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi #[% IF autodiscover_proxy_subdomains -%] # ScriptAliasMatch ^/Autodiscover/Autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi # ScriptAliasMatch ^/autodiscover/autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi #[% END -%] # Alias /bandwidth /usr/local/bandmin/htdocs/ # Alias /img-sys /usr/local/cpanel/img-sys/ # Alias /java-sys /usr/local/cpanel/java-sys/ # Alias /mailman/archives /usr/local/cpanel/3rdparty/mailman/archives/public/ # Alias /pipermail /usr/local/cpanel/3rdparty/mailman/archives/public/ # Alias /sys_cpanel /usr/local/cpanel/sys_cpanel/ # ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/ # ScriptAlias /mailman /usr/local/cpanel/3rdparty/mailman/cgi-bin/ # [% IF file_test('f', '/usr/local/cpanel/cgi-sys/scgiwrap') %]ScriptAlias /scgi-bin /usr/local/cpanel/cgi-sys/scgiwrap[% END %] #
    Am i doing something wrong or is there another procedure i mast follow ? Thanks in advance Dionisis.
    0
  • Samet Chan
    Hello guys , First of all very nice article, it helped a lot, By using the instructions i managed to remove the mydomain.com/cpanel and etc . But the cpanel.mydomain.com was not removed even when i removed all the Aliases Am i doing something wrong or is there another procedure i mast follow ? Thanks in advance Dionisis.

    Hey, you can remove only cpanel and webmail, whm. Here Before
    # # ScriptAliasMatch ^/?controlpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi # ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi # ScriptAliasMatch ^/?kpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi # ScriptAliasMatch ^/?securecontrolpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi # ScriptAliasMatch ^/?securecpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi # ScriptAliasMatch ^/?securewhm/?$ /usr/local/cpanel/cgi-sys/swhmredirect.cgi # ScriptAliasMatch ^/?webmail$ /usr/local/cpanel/cgi-sys/wredirect.cgi # ScriptAliasMatch ^/?webmail/ /usr/local/cpanel/cgi-sys/wredirect.cgi # ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi #[% IF autodiscover_proxy_subdomains -%] # ScriptAliasMatch ^/Autodiscover/Autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi # ScriptAliasMatch ^/autodiscover/autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi #[% END -%] # Alias /bandwidth /usr/local/bandmin/htdocs/ # Alias /img-sys /usr/local/cpanel/img-sys/ # Alias /java-sys /usr/local/cpanel/java-sys/ # Alias /mailman/archives /usr/local/cpanel/3rdparty/mailman/archives/public/ # Alias /pipermail /usr/local/cpanel/3rdparty/mailman/archives/public/ # Alias /sys_cpanel /usr/local/cpanel/sys_cpanel/ # ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/ # ScriptAlias /mailman /usr/local/cpanel/3rdparty/mailman/cgi-bin/ # [% IF file_test('f', '/usr/local/cpanel/cgi-sys/scgiwrap') %]ScriptAlias /scgi-bin /usr/local/cpanel/cgi-sys/scgiwrap[% END %] #
    After
    # #[% IF autodiscover_proxy_subdomains -%] # ScriptAliasMatch ^/Autodiscover/Autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi # ScriptAliasMatch ^/autodiscover/autodiscover.xml /usr/local/cpanel/cgi-sys/autodiscover.cgi #[% END -%] # Alias /bandwidth /usr/local/bandmin/htdocs/ # Alias /img-sys /usr/local/cpanel/img-sys/ # Alias /java-sys /usr/local/cpanel/java-sys/ # Alias /mailman/archives /usr/local/cpanel/3rdparty/mailman/archives/public/ # Alias /pipermail /usr/local/cpanel/3rdparty/mailman/archives/public/ # Alias /sys_cpanel /usr/local/cpanel/sys_cpanel/ # ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/ # ScriptAlias /mailman /usr/local/cpanel/3rdparty/mailman/cgi-bin/ # [% IF file_test('f', '/usr/local/cpanel/cgi-sys/scgiwrap') %]ScriptAlias /scgi-bin /usr/local/cpanel/cgi-sys/scgiwrap[% END %] #
    Save & exit, restart apache server.
    0
  • cPanelMichael
    But the cpanel.mydomain.com was not removed even when i removed all the Aliases

    Hello, If you'd like to disable the proxy subdomains, you can turn off the following option under the Domains tab in WHM >> Tweak Settings: Proxy subdomains Per it's description: Add proxy VirtualHost to httpd.conf to automatically redirect unconfigured cpanel, webmail, webdisk, cpcalendars, cpcontacts, and whm subdomains to the correct port (requires mod_rewrite, mod_headers, and mod_proxy) Or, if you only want to disable them for a specific domain name, run the following command:
    /scripts/proxydomains --domain=domain.tld remove
    Thank you.
    0
  • Dionisios S. Mpolanis
    Hello again , I disabled the proxi domain from the Tweek Tools (Capture2) And run the command for 2 of my domains on the server and restarted the server but nothing happened it is still the same. But i got an "Invalid value" Message when i turned of the proxi subdomains (Capture3)
    0
  • cPanelMichael
    but nothing happened it is still the same.

    Hello, Can you confirm that you are able to access proxy subdomains in a web browser for the domains you remove them on?
    But i got an "Invalid value" Message when i turned of the proxi subdomains (Capture3)

    This is a normal message because the two options referenced in the output require the use of proxy subdomains. Since you disabled proxy subdomains globally, then any values you enter for those options are not utilized. Thank you.
    0
  • Dionisios S. Mpolanis
    Thank you very much, the problem was solved.
    0
  • cPanelMichael
    Thank you very much, the problem was solved.

    I'm glad to see the issue is now solved. Thank you for sharing the outcome.
    0
  • ksvrach
    Hey! I have some questions 1. when someone enters domain.com/ whm on my website it takes them to my default whm page like server.login.net:2083 same with cpanel, can anyone find the server ip if they do this? 2.What if they enter the whm/ cpanel port directly on the domain? will it stop them?
    0
  • cPanelAnthony
    Hey! I have some questions 1. when someone enters domain.com/ whm on my website it takes them to my default whm page like server.login.net:2083 same with cpanel, can anyone find the server ip if they do this? 2.What if they enter the whm/ cpanel port directly on the domain? will it stop them?

    It's basically impossible to fully hide your server's IP from anyone. In order to access WHM or cPanel, you need to either use the IP address directly or a server/hostname that will resolve to the right IP address. For the second question, I'm not completely sure what you are asking.
    0

Please sign in to leave a comment.