Apache follows symlinks in unexpected ways on Dreamhost

I don’t know if this is just Dreamhost, I suspect its a general Apache thing, but following a Symlink for a directory doesn’t work the way I expected, so to help others avoid this problem, here’s the simple fix.

My Setup

I have an app in ~/my.domain with a directory called ‘something’ that is being served by Apache. Inside this directory are a bunch of other directories with files. The real ones were served fine, but the symlinked directories were causing 403 errors when I requested a file.

http://my.domain/something/real-dir/a-file works ok, but http://my.domain/something/symlink/a-file fails.

I do have the Options FollowSymLinks line in my .htaccess file.

Now to serve files for this app, the permissions need to be set to 755, and I’d set ‘something’, ‘real-dir’ and ‘symlink’, and their contents, to be 755, but still I’m getting errors.

The Fix

It turns out that I also need to set the real parent of ‘symlink’ to be 755 as well. Once I’d done this, files are flowing again.

I spent 2 hours on this, so you don’t have to!

This entry was posted on Sun, 15 Oct 2006 12:25:45 GMT . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.
Tags


Trackbacks

Use the following link to trackback from your own site:
http://blog.craz8.com/trackbacks?article_id=apache-follows-symlinks-in-unexpected-ways-on-dreamhost&day=15&month=10&year=2006

Comments

Leave a response

Leave a comment