Apache allow access to symlink

4

1

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.

Dalius

Posted 2014-07-16T08:25:25.917

Reputation: 143

First find out, if it is link-related or permission-related: Use Alias /uploads "/home/myusername/something" with a fitting <Direcotry> directive, retry and post results – Eugen Rieck – 2014-07-16T09:35:52.787

Answers

3

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.

Dmitry Vasilyanov

Posted 2014-07-16T08:25:25.917

Reputation: 246

Turns out it was a permission problem (option 2 helped). Thanks! :) – Dalius – 2014-07-16T10:19:20.837