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!

SOLVED Hosting files on hostname

Discussion in 'General Discussion' started by inteldigital, Apr 27, 2018.

  1. inteldigital

    inteldigital Active Member

    Joined:
    Apr 5, 2018
    Messages:
    38
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    England
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I am wanting to host a simple index file (with some other folders and CSS/fonts etc) on the hostname for my cPanel server so anyone accessing the link has directions to cPanel login etc as there are some links on the index page.

    How do I accomplish this? I figure it's not as easy as setting up a subdomain on the root account and bunging files in there.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,814
    Likes Received:
    133
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. inteldigital

    inteldigital Active Member

    Joined:
    Apr 5, 2018
    Messages:
    38
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    England
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi Lauren,

    Thanks again for your timely response, I do realise I can alter the default pages this way. But I am trying to host files on the hostname, just as you would any other website. I have dependencies that would not work inside the template editor, not only that but it would show these files in places I don't want them to appear.

    So to avoid this, I am trying to find out how to serve the files at the hostnames domain/URL.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,814
    Likes Received:
    133
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @inteldigital

    The documentroot is for the hostname is /var/www/html/ you could add your files there but you'd need to ensure that they're owned by the nobody user + group I tested this on my own server by doing the following:

    1. I went to WHM>>Service Configuration>>Apache Configuration -> directory index priority and ensured that index.php was the top (that way an index.html won't take precedence.)

    2. I created an index.php file and added some text to it
    Code:
    touch index.php
    3. I ran the following to change the UID and GID of the file:

    Code:
    chown nobody. index.php 
    Please keep in mind this configuration while possible to implement is not directly supported by cPanel.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. inteldigital

    inteldigital Active Member

    Joined:
    Apr 5, 2018
    Messages:
    38
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    England
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi Lauren,

    But then, won't the index.php show for every default page instead the index.html? I only want to show the (hypothetical) index.php on the hostname URL and everywhere else, the default cPanel template. Will this accomplish this task?

    Also, to note, it is an entire folder of content with .js and .css files plus one single index.html that I am trying to host.

    :)

    @cPanelLauren
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #5 inteldigital, Apr 27, 2018
    Last edited by a moderator: Apr 28, 2018
  6. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,814
    Likes Received:
    133
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hello,

    Yes, that would be correct, that's the problem you're going to run into with any modifications you make to the hostname, of this nature as far as I understand it. In testing on my personal server, I am unable to make modifications to the hostname without it affecting the default page as a whole.

    Thank you,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. inteldigital

    inteldigital Active Member

    Joined:
    Apr 5, 2018
    Messages:
    38
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    England
    cPanel Access Level:
    Root Administrator
    Twitter:
    @cPanelLauren

    Hi Lauren,

    Actually come to think of it, this wouldn't be such a bad thing I don't suppose. It would only affect the default page wouldn't it, as the error pages still exist. So, in theory, when would anyone see this page (aside from going directly to the hostname URL?)

    Regards,
    Ben
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,814
    Likes Received:
    133
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi Ben,

    That's correct, it wouldn't affect the other error pages. Only people who receive the default page would see the error. So if you had a domain that was pointed to your server but no account existed for it just yet you would also get the custom page.

    Thank you,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. inteldigital

    inteldigital Active Member

    Joined:
    Apr 5, 2018
    Messages:
    38
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    England
    cPanel Access Level:
    Root Administrator
    Twitter:
    @cPanelLauren

    Hi Lauren,

    Thanks for your help here, this is the solution I'm looking for. Have a great day.

    Regards,
    Ben
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,814
    Likes Received:
    133
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    I'm glad to hear that! You're very welcome, I'm glad I could help.
     
    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