Apache allow access to symlink

apache-http-serversymbolic-link

Please help me figure this out, I'm out of options what to even google. No idea why this apache configuration is not working as I expected.

<VirtualHost *:80>        
        DocumentRoot "/var/www/x/frontend/www"
        ServerName test.dev
        Alias /uploads "/var/www/x/common/uploads"
        <Directory "/var/www/x/frontend/www">
                AllowOverride All
        </Directory>
        <Directory "/var/www/x/common/uploads">
                Options +FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all   
        </Directory>
</VirtualHost>

Now, when accessing http://test.dev/uploads/something, I get 403 Forbidden. In apache error log:

"AH00037: Symbolic link not allowed or link target not accessible:
/var/www/x/common/uploads/something"

/var/www/x/common/uploads/something is a symbolic link to /home/myusername/something, which is a remote folder mounted with sshfs.

/home/myusername/something has 755 permissions and everything inside it has 777 permissions.

Best Answer

I have two guesses:

  1. /home/myusername has 750 permissions, so Apache is not able to access subdirectories

  2. The mounted directory is still not accessible for other users (FUSE does it by default), try sshfs -o allow_other to fix that.

Anyway, you need to determine whether it is something wrong with the Apache configuration or the Apache server can't access the files. Try to do sudo -u www-data ls /var/www/x/common/uploads/something (change the www-data to a user under which the apache is running on your system). If you get an error, you need to fix permissions somewhere, otherwise there is something wrong with the configuration.

Related Question