Moving web files to /home/user/ gives permission denied using apache

Posted by Maaz on Server Fault See other posts from Server Fault or by Maaz
Published on 2013-10-27T06:08:48Z Indexed on 2013/10/27 9:57 UTC
Read the original article Hit count: 249

Filed under:
|
|

I recently created some linux users on my machine and their respective directories were created in the following manner /home/my_user so I decided to treat each user as one of my websites.

I moved all my website files over to this directory like so /home/my_user/public_html/.

I edited the virtual host in my httpd.conf and changed the root directory folder so this is how that looks

<VirtualHost *:80>
   ServerAdmin [email protected]
   DocumentRoot "/home/my_user/public_html"
   ServerName mywebsite.com
   ServerAlias www.mywebsite.com
   ErrorLog "/var/log/httpd/mywebsite/error_log"
   CustomLog "/var/log/httpd/mywebsite/access_log" common
</VirtualHost>

Now this virtual host configuration was working perfectly fine with my older document root path that was located at /var/www/html/mywebsite/public_html but after changing that to what it is right now, I am getting a permission denied error.

But I followed the instructions here: http://stackoverflow.com/questions/14427808/you-dont-have-permission-error-in-apache-in-centos

Even after following the above instructions, when I run the following command: sudo -u apache ls /home/my_user/public_html

The server responds with

ls: cannot open directory /home/my_user/public_html: Permission denied

Even so, I do not get a permissions denied error when I try to access my site any more, however, now I am redirected to the default page of apache instead of my website.

I am not exactly sure what's wrong any more, if anyone has an idea, it would be great if you guys could help out!

© Server Fault or respective owner

Related posts about apache2

Related posts about centos