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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Temp URL to access domain before DNS propagation

Discussion in 'General Discussion' started by electric, Sep 26, 2017.

  1. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    727
    Likes Received:
    3
    Trophy Points:
    318
    Does cpanel have the ability to use a subdomain instead of http://serverIP/~username method for temporary URL access before a customer's domain is pointing to the server?

    For improved security, we don't want to enable the mod_userdir or the ability to access accounts using the server IP.

    But otherwise.. the only way the customer can see their website files is to use a local "hosts" file... and that is really too complicated for the majority of our customers.

    It would be nice if there was a way cpanel could automatically create a subdomain that runs off the server hostname, for each account.

    For example:

    http://AccountUsername.serverHostname.com

    Is this possible?
     
  2. jfall123

    jfall123 Well-Known Member

    Joined:
    Oct 31, 2005
    Messages:
    55
    Likes Received:
    2
    Trophy Points:
    158
    Not that I know of, but I fail to understand how/why you think that method would be any more secure than serverip/~user
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You'd have to manually add the subdomain to the cPanel account as an alias (parked domain) for that to work. Additionally, you'd need to enable the following option under the "Domains" tab in "WHM >> Tweak Settings":

    Allow users to park subdomains of the server’s hostname.

    Note that we do have a document on modifying the hosts file on a local computer should the end-users need help setting it up:

    How to Modify your hosts File - cPanel Knowledge Base - cPanel Documentation

    Thank you.
     
  4. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    727
    Likes Received:
    3
    Trophy Points:
    318
    OK, I enabled that setting in the WHM "Tweak Settings", and then logged into the customer's cpanel account and tried to add a subdomain of the server hostname. I got this error:

    ---------------
    There was an error when the system attempted to create the alias. Park::park failed: (XID a3wpm2) The domain “username.unique.ServerHostname.com” may not be created by “username” because “ServerHostname.com” is already owned by another user.
    ---------------

    Do you have any idea what might be the problem?
     
    #4 electric, Sep 26, 2017
    Last edited: Sep 26, 2017
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,459
    Likes Received:
    35
    Trophy Points:
    178
    cPanel Access Level:
    Root Administrator
    If there were a Park a Domain in the WHM API, that would help immensely. You could then create a hook to do this.

    But the calls for a WHM API Park a Domain function have been there for years and there's been no movement on that front.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    You'd also need to enable:

    "Allow cPanel users to create subdomains across accounts"

    Note that you should disable these options after you create the subdomains to avoid misuse of this feature from cPanel users.

    Thank you.
     
  7. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    727
    Likes Received:
    3
    Trophy Points:
    318
    I also tried using the WHM "Park a Domain" page, and this function allowed the subdomain "username.unique.ServerHostname.com" to be added successfully. (I am logged into WHM as root user.)

    However, when I go to the URL in my browser, it shows this page:

    http://username.unique.ServerHostname.com/cgi-sys/defaultwebpage.cgi

    It does not show the customer's website files, which I parked this hostname on top of. (I know the subdomain was added to the server, because I can actually see the "username.unique.ServerHostname.com" subdomain listed in the customer's cpanel account in the "aliases" page.)

    Any ideas what is the problem?
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Can you reproduce the same behavior when removing it as a WHM parked domain name, and instead adding the subdomain using "cPanel >> Aliases"?

    Thank you.
     
  9. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,459
    Likes Received:
    35
    Trophy Points:
    178
    cPanel Access Level:
    Root Administrator
    I would try restarting Apache first.

    Perhaps the DNS entry was made but Apache did not restart after adding the ServerAlias.

    Additionally running:

    Code:
    grep -B1 username.unique.ServerHostname.com /etc/apache2/conf/httpd.conf
    Should produce something and should show ServerName theusersmaindomain.tld
     
  10. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    727
    Likes Received:
    3
    Trophy Points:
    318
    Yes, the exact same behavoir happens when I try that. Here is what I tried:

    1. Enable the following two "Tweak Settings" in WHM:

    Allow users to park subdomains of the server’s hostname.
    Allow cPanel users to create subdomains across accounts.

    2. Login to customer's cpanel, and go to "Aliases" page.

    3. Try to create alias for "http://username.unique.ServerName.com". It says it works. However, if I go to the URL, then I see the generic page:

    http://username.unique.ServerName.co/cgi-sys/defaultwebpage.cgi

    So it seems the exact same problem happens, regardless of whether the subdomain is created in WHM using "Park a domain" page or the cpanel "Alias" page.

    Any ideas?
     
  11. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    727
    Likes Received:
    3
    Trophy Points:
    318
    Yes, the exact same behavoir happens when I try that. Here is what I tried:

    1. Enable the following two "Tweak Settings" in WHM:

    Allow users to park subdomains of the server’s hostname.
    Allow cPanel users to create subdomains across accounts.

    2. Login to customer's cpanel, and go to "Aliases" page.

    3. Create an alias for "username.unique.ServerName.com". It says it works. However, if I go to the URL, then I see the generic page:

    http://username.unique.ServerName.com/cgi-sys/defaultwebpage.cgi

    So it seems the exact same problem happens, regardless of whether the subdomain is created in WHM using "Park a domain" page or the cpanel "Alias" page.

    Any ideas?
     
    #11 electric, Sep 26, 2017
    Last edited: Sep 26, 2017
  12. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    727
    Likes Received:
    3
    Trophy Points:
    318
    I tried restarting apache, but that did not make any difference. The problem continues with no change.

    Yes, here is the output the command produces:


    Code:
    root [/]# grep -B1 username.unique.ServerHostname.com /etc/apache2/conf/httpd.conf
      ServerName TheUsersMainDomain.tld
      ServerAlias username.unique.ServerHostname.com mail.TheUsersMainDomain.tld mail.username.unique.ServerHostname.com www.TheUsersMainDomain.tld www.username.unique.ServerHostname.com
    root [/]# _
    Does it matter that TheUsersMainDomain.tld is not currently pointing to our servers? (The customer has not changed the nameservers for this domain yet, so it still points to the old hosting provider.)

    Any ideas?
     
  13. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,459
    Likes Received:
    35
    Trophy Points:
    178
    cPanel Access Level:
    Root Administrator
    Is theusersmaindomain.tld using a dedicated IP?

    When theusersmaindomain.tld was set up, what IP address was it given in the New Account message?

    What IP address does username.unique.serverhostname.com resolve to?

    Is it the same IP address?
     
Loading...

Share This Page