Httpd – Apache configuration for allowing a web site that is a symlink to a users directory

apache-2.2httpd

I have configure the httpd.conf in Apache (httpd-2.2.17-1.fc14.x86_64) on FC14 to point to a symlink that exists in the users home directory by adding the following config to the httpd.conf.

<VirtualHost *:80>
    ServerName site.test.co.uk
    DocumentRoot /var/www/html/site.test.co.uk
    <Directory "/home/userA/www/site.test.co.uk">
            AllowOverride None
            Options Indexes FollowSymLinks MultiViews
            Order allow,deny
            allow from all
    </Directory>
</VirtualHost>

I have then used the command

ln -s /var/www/html/site.test.co.uk /home/user/www/site.test.co.uk

I have give the user userA access to the directory structure and ownership of the folders in the home dir (I was logged in as root). I have also given the group apache access to the group userA and restarted httpd.

This issue I have is that when I view the site site.test.co.uk I get a 403 Forbidden error?

I can cd to the directory via the symlink and that works fine but apache does not seem to be able to access the symlink.

Thanks in advance.

Best Answer

Try cding to the folder using the Apache user,

Most likely its your home directory permissions, or permission somewhere on the top level

su apache
cd home
cd user
cd www
cd site.test.co.uk

If it fails, you need to add apache to the group of user and make sure the directory has Group read and write permission drwxr-x--- or 750

chmod -R 750 /home/user