User Sites not working after enabling Web Sharing in System Preferences on Snow Leopard

1

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.

orj

Posted 2009-09-09T15:01:04.150

Reputation: 303

Answers

1

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?

EvilChookie

Posted 2009-09-09T15:01:04.150

Reputation: 4 519

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 – 2009-09-11T12:54:13.380

0

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.

Quinn Taylor

Posted 2009-09-09T15:01:04.150

Reputation: 371