I can't seem to get a symlink working in my Apache VirtualHost, no matter what I try and I see the following error in the error log:

Symbolic link not allowed or link target not accessible: /var/www/carddesigner

I can browse the actual symlink from Linux with no problems whatsoever:

$ ls -l /var/www | grep "carddesigner"
lrwxrwxrwx 1 rfkrocktk rfkrocktk   64 2011-02-28 16:52 carddesigner -> /home/rfkrocktk/Documents/Projects/Work/carddesigner/build/main/

Additionally, I've made sure that the my VirtualHost allows the FollowSymLinks option:


    ServerAdmin ##########

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Deny from all

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128

    RewriteEngine On
    RewriteLog "/var/log/apache2/mod_rewrite.log"
    RewriteLogLevel 9

I can't seem to find any other configuration files that seem to override this and/or prevent symlinks from being loaded. Any ideas?

Here are my permissions on the actual referenced files:

$ ls -l ~/Documents/Projects/Work/carddesigner/build/main
total 12
drwxrwxrwx 5 rfkrocktk rfkrocktk 4096 2011-02-28 16:11 advanced
drwxrwxrwx 2 rfkrocktk rfkrocktk 4096 2011-02-28 16:10 core
drwxrwxrwx 2 rfkrocktk rfkrocktk 4096 2011-02-28 16:10 simple

Seems like the permissions are good to go, right?


What are the file permissions for the documents in /home/rfkrocktk/Documents/Projects/Work/carddesigner/build/main? They must be readable by the web server as well, not only the symlink.

| improve this answer | |
  • See my latest edit, seems like the permissions are good to go. – Naftuli Kay Mar 1 '11 at 2:56
  • 3
    For a symlink to work, the webserver must be able to traverse the whole tree down to that path. So, if any of the directories down to main are not executable for everyone, this won't work. – Sven Mar 1 '11 at 3:07
  • 1
    Had the same problem and the comment is important, check if your Apache can enter the directory, so all directories in path must have appropriate rights. – Mnementh Oct 27 '11 at 13:09
  • @SvenW You comment is SUPER important. Anyone having this issue, please pay attention. I finally got my deployment to work after making sure my permissions were as SvenW described. – Avery Chan May 28 '12 at 6:26
ls -Z /pat/to/www

drwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 www

chcon -Rv --type=httpd_sys_content_t /pat/to/www
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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