Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

/etc/apache2/sites-enabled/000-localhost:

<VirtualHost 127.0.0.1:80>
    ServerAdmin ##########

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

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

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

    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 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

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

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?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
See my latest edit, seems like the permissions are good to go. –  Naftuli Tzvi 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. –  SvW 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
share|improve this answer

Your Answer

 
discard

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.