Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/
    <Directory />
    Options FollowSymLinks
        AllowOverride Indexes

When I restart my apache server using sudo service httpd restart, I get the error:

Warning: DocumentRoot [/var/www/html/] does not exist

The current directory definitely exists. When I set the vhost to point to .../, 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/
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

My Error Logs:

[Wed Aug 29 00:04:39 2012] [error] [client] Symbolic link not allowed or link target not accessible: /var/www/html/
[Wed Aug 29 00:04:40 2012] [error] [client] Symbolic link not allowed or link target not accessible: /var/www/html/
[Wed Aug 29 00:04:40 2012] [error] [client] Symbolic link not allowed or link target not accessible: /var/www/html/, referer:

The ouput of ls -l for /var/www/html/

drwxrwxr-x 6 ec2-user ec2-user 4096 Aug 28 22:39 20120828223949

When I run the command ls -l /var/www/html/

ls: cannot access /var/www/html/ No such file or directory

Looks like a dead symlink... How do i fix this?

share|improve this question
Can you provide us with the output of ls -l /var/www/html/ At any rate, you should probably know that using symlinks in this way can lead to problems. – brain99 Aug 28 '12 at 23:36
This can be permission on one of the sub-folders of the destination of the link, as symlink is always rwxrwxrwx, so you need to grant your apache access to it. – Andrew Smith Aug 28 '12 at 23:36
Does the apache user (I assume apache runs as user ec2-user) have execute permissions on /var/www/html/ and all parent directories? – brain99 Aug 29 '12 at 3:46
Unless you've redeployed between edits, your problem is a dead symlink. current is pointing at a directory ending 223437, and your releases directory contains a directory ending 223949. – nickgrim Aug 29 '12 at 10:01
Does ls -l /var/www/html/ (note trailing slash) return what-you-expect? – nickgrim Aug 29 '12 at 10:05
up vote 1 down vote accepted

As-per-my-comment and your follow-up it looks like your current symlink doesn't point to a valid target; remove it and re-add it:

$ rm -f /var/www/html/
$ ln -s /var/www/html/{releases/20120828223949,current}
share|improve this answer
Thanks! I ran rm -f /var/www/html/ && ln -s /var/www/html/ /var/www/html/ and it worked! – Anil Aug 29 '12 at 12:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.