inteldigital

Well-Known Member
Apr 5, 2018
88
15
8
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.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston

inteldigital

Well-Known Member
Apr 5, 2018
88
15
8
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.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
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.
 

inteldigital

Well-Known Member
Apr 5, 2018
88
15
8
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
 
Last edited by a moderator:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
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,
 

inteldigital

Well-Known Member
Apr 5, 2018
88
15
8
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
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
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,
 

inteldigital

Well-Known Member
Apr 5, 2018
88
15
8
England
cPanel Access Level
Root Administrator
Twitter
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,
@cPanelLauren

Hi Lauren,

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

Regards,
Ben