I have recently setup Capistrano on my server and it works great.
I changed my virtual hosts to point to the symbolic link created by Capistrano.
My virtual hosts file:
<VirtualHost *:80>
DocumentRoot /var/www/html/my_app.com/current
ServerName my_app.com
<Directory />
Options FollowSymLinks
AllowOverride Indexes
</Directory>
</VirtualHost>
When I restart my apache server using sudo service httpd restart
, I get the error:
Warning: DocumentRoot [/var/www/html/my_app.com/current] does not exist
The current
directory definitely exists. When I set the vhost to point to .../my_app.com/
, it works and shows the default apache page, the problem is this symbolic link to current
(which is updated as I deploy applications using capistrano).
I am using a Amazon ec2 instance, apache 2.2 (LAMP).
so basically, how do I point a virtual host to a symbolic link?
Update The output of
ls-l
:
lrwxrwxrwx 1 ec2-user ec2-user 57 Aug 28 22:40 current -> /var/www/html/my_app.com/releases/20120828223437
drwxrwxr-x 3 ec2-user ec2-user 4096 Aug 28 22:40 releases
drwxrwxr-x 6 ec2-user ec2-user 4096 Aug 28 16:01 shared
In my httpd.conf
(comments stripped out):
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
My Error Logs:
[Wed Aug 29 00:04:39 2012] [error] [client 87.194.51.136] Symbolic link not allowed or link target not accessible: /var/www/html/my_app.com/current
[Wed Aug 29 00:04:40 2012] [error] [client 128.30.52.73] Symbolic link not allowed or link target not accessible: /var/www/html/my_app.com/current
[Wed Aug 29 00:04:40 2012] [error] [client 87.194.51.136] Symbolic link not allowed or link target not accessible: /var/www/html/my_app.com/current, referer: http://mydomain.com/
The ouput of ls -l
for /var/www/html/my_app.com/releases/20120828223949
.
drwxrwxr-x 6 ec2-user ec2-user 4096 Aug 28 22:39 20120828223949
When I run the command ls -l /var/www/html/my_app.com/current/
ls: cannot access /var/www/html/my_app.com/current/: No such file or directory
Looks like a dead symlink... How do i fix this?