Amazon EC2 Apache Symbolic Link Not Allowed
I have created an Amazon EC2 instance and installed Apache and PHP on it:
$ sudo yum install apache2 $ sudo yum install php $ ls -al /var/www/services/ lrwxrwxrwx 1 root root 42 Jun 22 21:13 production -> /home/ec2-user/services
The I have created new VirtualHost:
<VirtualHost *:80> ServerName ec2-***.compute-1.amazonaws.com DocumentRoot "/var/www/services/production/public" <Directory "/var/www/services/production/public"> Options Indexes MultiViews FollowSymLinks AllowOverride All Order deny,allow Allow from all </Directory> </VirtualHost>
Now, when I run my request in the browser, it says 403 Forbidden and the log shows symlink problem:
[Wed Jun 22 21:14:19 2011] [error] [client ***] Symbolic link not allowed or link target not accessible: /var/www/services/production [Wed Jun 22 21:14:20 2011] [error] [client ***] Symbolic link not allowed or link target not accessible: /var/www/services/production
What's wrong? Is EC2 blocking symlinks? Please help!
Now, the only problem I could think of is permission to access production by apache user. Make sure the permission to /var/www/services/production (& the target folder) folder is set to 0755 on both symbolic links & target folder.
Test: Become the user as apache (sudo -u apache) and now try to change into the directory (cd) and make sure apache user is able to traverse.
Does Apache have read permissions on /home/ec2-user/services? Symlinks are by design 0777 for permissions, but only so everything flows through to take up the permissions of whatever the symlink is pointing at.