Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symbolic link not allowed in Apache2

I'm trying to get a website running under Apache but I'm getting the following error:

AH00037: Symbolic link not allowed or link target not accessible: /var/www/wg

The folder "wg" is indeed a symlink however as far as I can see the permissions are set correctly, and the link is valid:

lrwxrwxrwx  1 www-data www-data   33 Dec  8 22:36 wg -> /media/user/Web/www/wg

And this is how the website is setup:

<VirtualHost 127.0.0.49:80>
        DocumentRoot "/var/www/wg"
        ServerName wg.local
        <Directory "/var/www/wg">
                Options +Indexes +FollowSymLinks -SymLinksIfOwnerMatch
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Any idea what could be causing this permission error?

Edit:

strace gives me this:

[pid  8603] stat("/var/www/wg/", 0x7fff01b68010) = -1 EACCES (Permission denied)

But I don't understand why - "var" and "www" are drwxr-xr-x and wg drwxrwxrwx with www-data owner and group, so everything seems to be setup correctly.

like image 603
laurent Avatar asked Nov 10 '22 22:11

laurent


1 Answers

I would assume, that the rights on /media/user/Web/www/wg are set wrong, so the log is misleading. Or that the users of /media/user/Web/www/wg and /var/www/wg are not the same, because you've set -SymLinksIfOwnerMatch.

Another solution/question: why aren't you not setting the DocumentRoot directly to /media/user/Web/www/wg?

Best, M.

like image 173
Matthias Fleschütz Avatar answered Dec 06 '22 04:12

Matthias Fleschütz