Saturday, July 30, 2016

httpd - Apache configuration for allowing a web site that is a symlink to a users directory




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.




ServerName site.test.co.uk
DocumentRoot /var/www/html/site.test.co.uk

AllowOverride None
Options Indexes FollowSymLinks MultiViews
Order allow,deny

allow from all




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.


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

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...