up vote 1 down vote favorite
share [g+] share [fb]

I'm using Snow Leopard (upgraded from Leopard) and in System Preferences I have enabled "Web Sharing". The preference pane lists the following urls as active:

http://192.168.1.67/
http://192.168.1.67/~myusername/

When I click on the first link I get a page with "It Works" in big letters. When I click on the second link I get a "Forbidden" error and Apache logs into error_log "client denied by server configuration".

To fix this I had to add a .conf file in /etc/apache2/users with the content:

<Directory /Users/myusername/Sites>
    Order allow,deny
    Allow from all
</Directory>

Now I can access http://192.168.1.67/~myusername/ just fine.

Is this normal? I would have thought Apple would make this a tad easier for users to enable per user site sharing.

link|improve this question

25% accept rate
feedback

2 Answers

up vote 1 down vote accepted

I would imagine this is a form of security, particularly if you're using multiple accounts. It's easier to enable browsing through the .conf file for one user account, then it is to disable browsing for several accounts.

Malicious people then just simply can't enable web sharing and have unrestricted access to a user folder, unless they edit the conf file first.

Edit: I enabled sharing on my Snow Leopard installation, and it worked straight off the bat. Perhaps it was just a bug that the .conf file wasn't setup correctly?

link|improve this answer
Yeah I think it was probably a bug or glitch. In the past (on previous MacOS editions) it has worked just fine out of the box. I kinda just wanted to share my experience in case others have the same problem. – orj Sep 11 '09 at 12:54
feedback

This was problematic for Leopard as well. It seems to work on Lion now. Within /etc/apache2 (aka /private/etc/apache2), httpd.conf includes extra/httpd-userdir.conf, which has these lines of interest:

UserDir Sites
...
Include /private/etc/apache2/users/*.conf

So, it seems that having ~/Sites may be sufficient, although you may have to create that folder yourself.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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