Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Removing IP URL to cPanel

Discussion in 'General Discussion' started by Jallekobber, Feb 18, 2018.

Tags:
  1. Jallekobber

    Jallekobber Member

    Joined:
    Jul 12, 2012
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    To start off I can say that my domains nameservers is pointed to Clouudflare and the DNS is controlled by Cloudflare as well. Then I point my domain to the IP Address of my WHM / cPanel installation. This setup is only for a single domain just because I wanted the extra privacy with a VPS for web hosting.

    When you type the domain my site works perfectly (With SSL) but you can connect directly to the server with the direct IP which I want to be hidden from the public to remove the possibility of any kinds of attacks.

    How do I disable connecting through the browser with the IP of my WHM / cPanel Server and enforce my domain to connect to it with my cloudflare setup?

    Another question for me lies how should my Cloudflare propagation look for my private vps cpanel hosted site? (eg. DomainRegistor > Cloudflare > cPanel server or DomainRegistor > cPanel > Cloudflare? I have always beliewed that Cloudflare should be in front of my web server but this limits WHM & cPanels functions.

    Any ideas and comments would be greatly appreciated.

    Regards, Jake
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,861
    Likes Received:
    89
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    If you have a domain coming through CloudFlare, and when you access cPanel through such domain, you might experience some cPanel layout issues in the panel..

    You can use the CloudFlare to protect your domain from attack, but if you want to protect your server from this, you will have to get a hardware firewall for your server, so it will be protected..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,749
    Likes Received:
    1,884
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You can follow the steps referenced below (partly taken from our SSL FAQ document) to prevent access to your domain name over it's IP address.

    1. Navigate to WHM's Include Editor interface (WHM Home >> Service Configuration >> Apache Configuration >> Include Editor).

    2. Select the Pre Virtual Host Include option.

    3. Select the Apache version from the menu. We recommend that you select All Versions.

    4. Enter the following text in the available text box:

    Code:
    <VirtualHost IPADDRESS:80>
      ServerName HOSTNAME
      DocumentRoot /usr/local/apache/htdocs
      ServerAdmin EMAIL
      <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
      </IfModule>
     </VirtualHost>
    
    <VirtualHost IPADDRESS:443>
      ServerName HOSTNAME
      DocumentRoot /usr/local/apache/htdocs
      ServerAdmin EMAIL
      <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
      </IfModule>
        SSLEngine on
        SSLCertificateFile SSLCERTIFICATEFILE
        SSLCertificateKeyFile YOUR-SSLCERTIFICATEKEYFILE
     </VirtualHost>
    Note:

    This example uses the following values:
    • IPADDRESS represents your IP address.
    • HOSTNAME represents your server's hostname.
    • EMAIL represents your contact email address.
    • SSLCERTIFICATEFILE represents the full file path to your SSL certificate.
    • SSLCERTIFICATEKEYFILE represents the full file path to your SSL certificate's key.
    5. Click Proceed
    6. Click Update.

    Additionally, note that you'd need to update the DocumentRoot values to reflect a directory with an index file or .htaccess file that denys access.

    As far as your second question, CloudFlare should come before the cPanel server. See this page on their documentation:

    My cPanel won't load or keeps logging me out after enabling Cloudflare

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice