Forbidden - You don't have permission to access / on this server

if I do it this way: it works

DocumentRoot /var/www
<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>
<Directory /var/www>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

drwxr-xr-x  2 root root     4096 nov  6 15:27 www

but if I do this: does not work

DocumentRoot /home/diego/web_server
<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>
<Directory /home/diego/web_server>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>


drwxr-xr-x 2 root root 4096 mar  4 15:40 web_server 

I'm doing wrong?


Solution 1:

If there isn't an index file (index.html) in /home/diego/web_server and want to get a directory listing, autoindex module must be enabled:

sudo a2enmod autoindex
sudo service apache2 restart

If there is an index file, check its permision, should be 644 (-rw-r--r--).

Check also your home (/home/diego) permissions, it should be 755 (drwxr-xr-x) just like www and web_server.

Solution 2:

  1. Check /home permissions, should be 755 (drwxr-xr-x)
  2. Check /home/diego permissions, should be 755 (drwxr-xr-x), if not, do chmod
  3. Check /home/diego/web_server, should be 755 (drwxr-xr-x), if not, do chmod

Try now, above 403 (Forbidden) error should not be there.