Ubuntu – How to configure apache2 with symbolic links in /var/www/

Apache2permissionssymbolic-linkvirtualhost

I want to setup a local web server on my Ubuntu (14.04). So I installed all software to get a LAMP server.

The problem is that I do something wrong with creating my virtualhosts. I wanted to create different subdomains on my localhost. So for example site1.localhost and site2.localhost.

In my /var/www/ directory I created a symbolic link "site1" going to /home/user/Workspaces/site1.

In my Apache error.log file I got the following error.

[core:error] [pid 12679] [client 127.0.0.1:59006] AH00037: Symbolic link not allowed or link target not accessible: /var/www/site1

In my apache configuration I have:

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

So I think there is something wrong with the permissions of the folders. I searched on Google and I found a few people with the same problem but all answers provided there didn't work out. I added my own username tot the www-data group and things like that.

So ls -la /var/www returns:

total 12
drwxrwsr-x  3 user www-data 4096 okt 13 19:08 .
drwxr-xr-x 14 root root     4096 okt  1 22:50 ..
drwxr-xr-x  2 root www-data 4096 okt  1 22:50 html
lrwxrwxrwx  1 root www-data   29 okt 13 19:08 site1 -> /home/user/Workspaces/site1/

and ls -la /home/juul/Workspaces/site1 returns:

total 24
drwxrwxr-x 4 user www-data 4096 okt 13 18:21 .
drwxrwx--- 3 user user     4096 okt 13 17:31 ..
-rw-rw-r-- 1 user user        0 okt 13 18:21 index.html
drwxrwxr-x 4 user www-data 4096 okt 13 16:12 .metadata
drwxrwxr-x 5 user www-data 4096 okt 13 16:53 Project

Hopefully someone can help me out with this 🙂

Best Answer

These permissions are preventing apache from accessing you

drwxrwx--- 3 user user     4096 okt 13 17:31 ..

You need to give execute permissions for others:

chmod o+x /home/juul/Workspaces/

(and perhaps on /home/juul/ as well).