I'm using Ubuntu 14.04, and have a problem with the Apache configuration:

I created a Symlink from /var/www/html torwards /home/me/myWebDirectory

but localhost/myWebDirectory renders a

403-permission denied

and in fact, sudo -u www-data ls /home/me/myWebDirectory returns a permission denied too

apache2.conf had following directive :

<Directory /var/www>
           Options Indexes FollowSymLinks
           AllowOverride None
           Require all granted

I changed it for <Directory /var/www/html>, but no result.

I tried to add the me user to www-data group with this command sudo usermod -a -G groupName userName, but that didn't help either

what is it that I missed?

EDIT: I changed the group of /home/me/myWebDirectory into www-data with rx rights, but no success either...

As I said, I was well aware that I had a reading permission problem as this sudo -u www-data ls /home/me/myWebDirectory returning me a permission denied too (which means www-data doesn't have the rights to see what in it).

But I need certain point of your answer to be clearer :

Also you should use url "localhost/html" instead of "localhost/myWebDirectory".

Actually I've made the Symlink like follow :

  • cd /var/www/html
  • ln -s /home/user/me/myWebDirectory myWebDirectory

so I think accessing localhost/myWebDirectory is the right address, no?

chown -R www-data:www-data /var/www/html

  • since ubuntu 14.04, Apache DocRoot is /var/www/html, why should i chhange its owner (like many other deamons, roots by default).
  • /localhost/testfile.html works fine (undertsand testfile is in /var/www/html)
  • /localhost/phpmyadmin works too, even if it's a SymLink to /usr/share (while m trying to have a symLink to /home/user...)

chmod +r /var/www/html # add read permission to dir

chmod +r /var/www/html/* # add read permission to files in dir
  • Add read permission to who? to myUser?
  • But that is exactly what I don't want to do.
  • I actually want apache to be able to read in /home/me/myWebDirectory and not myUser to go write in apache's directories.

NB: I know there's another way to do it, while activating the apache mod_userdir and that's probably what i'll be going to do next. But first i'd like to understand how to make this "simple" solution work...


i finally solved my problem with following solution, may it help anyone in the future...

sudo chown me:www-data /home/me
sudo chmod 710 /home/me

sudo chown -R me:www-data /home/me/myWebDirectory

sudo chmod -R g+r /home/me/myWebDirectory

Caution : you may for example not want all subdirectories to be readable by apache, so adapt the -R(ecursive) directive.

But important is to give the apache user group read access to ur home then read access to the concerned infant.

| improve this answer | |

The problem exists because of missing read permissions. Execute:

# chmod +r /var/www/html  # add read permission to dir
# chmod +r /var/www/html/* # add read persmission to files in dir
# chown -R www-data:www-data /var/www/html

Also your shouse use url "localhost/html" instead of "localhost/myWebDirectory".

| improve this answer | |

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.