User home directory as document root of a domain with WHM/cPanel

2h1n846

Member
Nov 3, 2020
6
0
1
Dhaka
cPanel Access Level
Root Administrator
I have 1 user license for WHM/cPanel .
WHM/cPanel allows only 1 SSH user, the same as the cPanel user.
So I had to add more SSH users from the command line for different purposes.
Now I am trying to point a domain to that SSH user home directory.

I have modified the "/var/cpanel/userdata/username/example.com.conf" file to point the example.com to a user home directory "/home/sammy/"
But it's always returning "404 not found".
What I am doing wrong? Do I need to adjust configuration anywhere else?
 

kodeslogic

Well-Known Member
Apr 26, 2020
334
128
118
IN
cPanel Access Level
Root Administrator
After modifying files have you Rebuild the Apache conf and reload the Apache configuration?


Code:
/scripts/rebuildhttpdconf
service httpd graceful
Then clear your browser cache and refresh the page.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,027
313
cPanel Access Level
Root Administrator
In general, there are going to be many configuration conflicts between a standard Linux user and a cPanel user with hosting. cPanel creates many files to ensure things get setup properly in WHM, cPanel, Apache, PHP, DNS, MySQL, and other services, so trying any manual workarounds like this is something we don't test as it's not supported.

It would be better to undo any previous work and then try to create the addon domain to see if that gets things working how you expect. That would ensure all the necessary files for Apache are in place.

If you are geting a 404 error, it may also be worth it to check the Apache logs at /etc/apache2/logs/error_log to see if that gives you more details about what the problem may be.
 

2h1n846

Member
Nov 3, 2020
6
0
1
Dhaka
cPanel Access Level
Root Administrator
In general, there are going to be many configuration conflicts between a standard Linux user and a cPanel user with hosting. cPanel creates many files to ensure things get setup properly in WHM, cPanel, Apache, PHP, DNS, MySQL, and other services, so trying any manual workarounds like this is something we don't test as it's not supported.

It would be better to undo any previous work and then try to create the addon domain to see if that gets things working how you expect. That would ensure all the necessary files for Apache are in place.

If you are getting a 404 error, it may also be worth it to check the Apache logs at /etc/apache2/logs/error_log to see if that gives you more details about what the problem may be.
Already done this and got the same 404 error...
Removed DNS entry for the domain, added the domain again as addon domain then pointed outside of cPanel home, updated the directory owner,group, permission...nothing helped
And no error log for the target domain in apache error_log found if I point the domain outside of the cPanel home directory.

I just couldn't figure it out and quit...
 

2h1n846

Member
Nov 3, 2020
6
0
1
Dhaka
cPanel Access Level
Root Administrator
If you'd like our team to look into that a bit more for you, feel free to submit a support ticket using the link in my signature and we can check it out.
Well, I already did that too!!
Unfortunately, that guy from the support team just quit as well saying something like, "This is not a part of cPanel functionality so I am not resolving this..."
 

2h1n846

Member
Nov 3, 2020
6
0
1
Dhaka
cPanel Access Level
Root Administrator
Any chance you could get me the ticket number? While I do agree the core issue isn't part of cPanel's functionality, we may be able to come up with something else.
Here it is: #93880516

The addon domain (sub domain got from AWS) "ec2-x-x-x-x.compute-1.amazonaws.com" is currently pointed under cPanel directory...but you can point it to any SSH user directory you see under /home for testing purpose.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,027
313
cPanel Access Level
Root Administrator
Thanks for that :D

Is it possible there is a caching issue on your side causing a problem? When I visit the full URL in the ticket on my end I get taken to a password prompt, and I do see there is a .htpasswd file on the account.

Could you try this work from a different browser just to rule that out?