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.

Hostname goes to Default Web Page

Discussion in 'Bind / DNS / Nameserver Issues' started by ItsMattSon, Sep 18, 2016.

Tags:
  1. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi guys,

    Note quickly that I have read this thread here and it was enlightening but my query I feel is a little different. Just chasing the "correct" procedure, I suppose.

    My hostname srv.domain.com goes to the Default Web Page .cgi and so does the actual domain domain.com so I was wondering if there was a guide on how to make those URLs show specific splash pages.

    I tried to create a new account in WHM for domain.com but it didn't allow me (because of DNS zones, or something to that effect). Presume it already has entries for the domain name, I'm not sure.

    What would be the right way to change the splash page for your hostname and the domain name? (not looking to modify the default web page, by the way)
     
  2. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Update on the above. Not sure why the DNS zone was there but it was so I deleted it and then made a new account for domain.com and logged into FTP and uploaded an index for it.

    As for srv.domain.com (hostname), not sure how I should be putting a splash on that if at all. I could login to domain.com's cPanel and then create a subdomain and put another splash in there via FTP? But again, not sure how this is *supposed* to be done, even if that would sort it.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    650
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can modify the template for the default website page using "WHM Home >> Account Functions >> Web Template Editor":

    Web Template Editor - Documentation - cPanel Documentation

    Is this what you are attempting to do?

    Thanks!
     
  4. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi @cPanelMichael,

    Close, but actually I was just wondering how I can put a splash page on my hostname address, since it resolves to the 'Default Webpage' (http://srv.site.com/cgi-sys/defaultwebpage.cgi) in my browser.

    I tried to create a subdomain called srv to upload an index page there but cPanel was clever enough not to let me create subdomain with same name as hostname.

    Preferably, I'd not want to edit the template because it is correct the way it is. I'd just like to change the page I see when hitting my hostname from a browser :)
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    650
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  6. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Thanks @cPanelMichael.

    Can i confirm that I am meant to be making a copy of ea4_main.default as ea4_main.local and then editing that document somewhere?

    I noticed when trying to find the appropriate line, it said "DO NOT EDIT. AUTOMATICALLY GENERATED. USE INCLUDE FILES IF YOU NEED TO MAKE A CHANGE" so wasn't sure I'm editing the right file? Do i need to find the appropriate include?

    Sorry to come back so quickly on this one - I'm afraid I'm not 100% sure which file to edit or where in it.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    650
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, once you make the copy, you then edit the /var/cpanel/templates/apache2_4/ea4_main.local file directly via the command line.

    However, there's actually an easier solution for a single VirtualHost change that you may find helpful. First, browse to:

    "WHM Home » Service Configuration » Apache Configuration » Include Editor"

    Edit "All Versions" under "Pre VirtualHost Include", and enter the custom VirtualHost for the IP address. EX:

    Code:
    <VirtualHost 1.2.3.4:80>
        ServerName 1.2.3.4
        DocumentRoot /home/example/public_html
        ServerAdmin root@hostname
    
        <IfModule suphp_module>
            suPHP_UserGroup nobody nobody
        </IfModule>
    
    </VirtualHost>
    Replace the "DocumentRoot" value with the path of your choosing and click "Update". You may also want to add an additional VirtualHost entry with the same lines, except with port 443 instead of 80.

    Thank you.
     
  8. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi @cPanelMichael,

    Tried the WHM approach as that seemed cleaner for me and I thought that was going to be a winner but for some reason it actually didn't work.

    Where 1.2.3.4 was mentioned twice in your example, I used my Server IP (it's a shared IP that all my domains on my VPS use) in both those places; Then replaced the DocumentRoot path to /home/mydomainaccountname/public_html and; then copy/pasted the lot and changed the port to 443. Since it didn't work after restarting Apache, I removed ServerAdmin line altogether, as I understand it's not required and thought that might've been why but no dice.

    I then tried to hit http://srv.mydomain.com in my browser and it went to the same /cgi-sys/defaultwebpage.cgi so I cleared cache and relaunched browser and it still redirected to that page.

    I thought I better just try it in the Post VirtualHost Include section instead just in case it was being overridden in anyway by a later vhost entry but again no dice.

    Would I have missed something?

    EDIT: Tried to hit the IP in the browser and Firefox claims it isn't redirecting properly.

    "The page isn’t redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
     
    #8 ItsMattSon, Sep 30, 2016
    Last edited: Sep 30, 2016
  9. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    I might be clutching at straws here but could this be related? (a redirect on DocumentRoot of some sort?)

    stackoverflow.com/a/21441260
     
    #9 ItsMattSon, Oct 3, 2016
    Last edited by a moderator: Oct 4, 2016
  10. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    71
    Likes Received:
    16
    Trophy Points:
    8
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi @cPanelMichael,

    I couldn't figure that out so I went back to your original suggestion of editing the Templates which I'm actually pretty happy with. It is not a bad solution after all.

    I'd like to point out that I'm sure your answer was correct but it was probably something I couldn't figure out with my setup that was preventing your solution from doing as expected.

    Thanks for helping! Onto the next stage... :)
     
    jonam_mafia and cPanelMichael like this.
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    650
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I'm happy to see it helped. Thank you for updating us with the outcome.
     
Loading...

Share This Page