Apache 2 Symbolic link not allowed or link target not accessible

apache-2.2centos5symlinkvirtualhost

My apache server runs as user foo.

I have some Rails applications in /home/foo/app1 /home/foo/app2.
Each of them has an vhost

<VirtualHost *:80>
    ServerName app1.foobar.com
    ServerAlias www.app1.foobar.com
    DocumentRoot /var/www/html/app1/current/public
    RailsEnv production
    <Directory /var/www/html/app1/current/public>
    AllowOverride all
     Options -MultiViews
    </Directory>
</VirtualHost>

I have a symlink in /var/www/html/app1 :

current -> /home/foo/app1/tmp_20102611

All file permissons are set correctly (user foo group foo), I can go through the filesystem from shell.

SELINUX is disabled

Distro is CentOs 5.5

Which the above symlink I get an 403 and an error entry in error_log

Symbolic link not allowed or link target not accessible:/var/www/html/app1/current

When I symlink my app in the subdir of /var/www/html instead of /home/foo it works.

How I can avoid this error still placing my app in my /home/foo directory ?

Best Answer

I had a very similar problem. Like you, I was unable to follow symlinks under my home directory even though I had the FollowSymlinks enabled plus I could ls around with my http user, but putting symlinks under /srv/http worked just fine... I fixed it by chmod'ing my home directory to be executable:

chmod +x /home/mgalgs

And that did it for me! Maybe try

chmod +x /home/foo/app1
Related Topic