up vote 5 down vote favorite
6
share [g+] share [fb]

On my Mac OS 10.5 machine, I would like to set up a subfolder of ~/Documents like ~/Documents/foo/html to be http://localhost/foo.

The first thing I thought of doing is using Alias as follows:

Alias /foo /Users/someone/Documents/foo/html

<Directory "/Users/someone/Documents/foo/html">
    Options Indexes FollowSymLinks MultiViews

    Order allow,deny
    Allow from all
</Directory>

This got me 403 Forbidden. In the error_log I got:

[error] [client ::1] (13)Permission denied: access to /foo denied

The subfolder in question has chmod 755 access. I've tried specifying likes like http://localhost/foo/test.php, but that didn't work either. Next, I tried the symlink route.

Went into /Library/WebServer/Documents and made a symlink to ~/Documents/foo/html. The document root has

Options Indexes FollowSymLinks MultiViews

This still got me 403 Forbidden:

Symbolic link not allowed or link target not accessible: /Library/WebServer/Documents/foo

What else do I need to set this up?

Solution:

$ chmod 755 ~/Documents

In general, the folder to be shared and all of its ancestor folder needs to be viewable by the www service user.

link|improve this question
Thanks so much for posting this solution - this really helped me out after spending ages looking for the answer – Tomba Jan 31 at 13:55
@Tomba No problem. – eed3si9n Jan 31 at 14:28
feedback

3 Answers

up vote 11 down vote accepted

I'll bet that some directory above the one you want to access doesn't have permissions to allow Apache to traverse it. Become the user that Apache is running as (sudo -i -u apache or whatever), then try to change into the directory of interest and ls it. If you can't (as expected), then try getting into the directories above it, one by one, until one lets you in. The subdirectory of that is that one that needs to have o+x set. Lather, rinse, repeat as required.

link|improve this answer
Yes, if 'Sites' is working, you probably have a right problem on Documents, if 'Sites' is not working you probably have a right problem on your user directory (this can appends with filevault) – radius Jun 29 '09 at 1:37
1  
~/Documents was 700. – eed3si9n Jun 29 '09 at 1:40
feedback

Check your /Users directory (ls -l /Users) to see rights on your user (someone).
Also is the 'Sites' directory correctly available on localhost/~someone ?

link|improve this answer
localhost/~someone works. – eed3si9n Jun 29 '09 at 1:54
feedback

Use +FollowSymlinks

Alias /foo /Users/someone/Documents/foo/html

<Directory "/Users/someone/Documents/foo/html">
    Options +Indexes +FollowSymLinks +MultiViews

    Order allow,deny
    Allow from all
</Directory>
link|improve this answer
According to httpd.apache.org/docs/2.0/en/mod/core.html#options, "if all the options on the Options directive are preceded by a + or - symbol, the options are merged." How is that going to help ~/Documents being 700? – eed3si9n Jun 29 '09 at 4:16
AFAIK FollowSymLinks does not enable the option, only allows it to be enabled in at a lower level of the directory hierarchy. – Dave Cheney Jun 29 '09 at 4:52
feedback

Your Answer

 
or
required, but never shown

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