1

I just opened a new VPS hosting account, with a hosting company I haven't used before, and I can't get the server to pick up the public_html directory in my user account's home directory. The server will only serve the files from /var/www/html.

Going back for a moment, I opened a new VPS account and the hosting service gave me root access to WHM. From WHM I created a new user called "admin_bob" with the domain "mysite.com". I dropped a hello_world.html in to admin_bob's public_html directory and the /var/www/html (I put a little text into the html file to differentiate the two). When I go to mysite.com/hello_world.html I see the one that is from /var/www/html.

If I go to cPanel and click on Domains (under the Domains category), I can see the Document Root for the domain "mysite.com" to be clearly displayed as /home/admin_bob/public_html.

What to I have to do to get the web server to pick up the hello_world.html from admin_bob's public_html directory (/home/admin_bob/public_html)?

The server is a LAMP with CentOS 7.

  • I don't know anything about cPanel, but have you looked at the configuration files that cPanel has written? Have you restarted the server? – Stephen Ostermiller Aug 21 at 22:59
2

I found the answer and it had to do with the IP address that I was using for the DNS. I received two IP addresses with my hosting account. A primary IP address and a secondary one. I'd assigned the secondary IP address the host records of my domain name for the DNS. Looking at the httpd.conf file I could see the directives that were responsible for setting my document root to my public_html directory listed the primary IP address. So I went back and fixed the host records for my domain name to use the primary IP address and like magic the problem was solved.

1

Www is usually a symbolic link (ie. an alias) of public_html. If you retrieve the file from your public_html directory in cPanel, you'll notice that it should be the same that you dropped in to the www directory (the latest file overwriting the original). If that's not the case, then your hosting company have failed to implement a symlink, and you should contact them.

Reason why a symlink is done is because certain programs expect the www version and others expect the public_html (so it should guarantee functionality with all programs).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.