MacOS X 10.5, Apache and my Sites folder.

They’re not working. When I point the web browser to localhost/~me, I get a 403 error: forbidden.

Chasing down the configuration files, it turns out:

(1) The httpd.conf file controlling Apache is located in /etc/apache2.
(2) It uses mod_userdir in order to map the Sites folder in my home directory to the web browser.
(3) The default access is set in the httpd.conf file to deny all–meaning by default I cannot browse files.
(4) To configure the mod_userdir, httpd.conf includes httpd-userdir.conf from the directory /private/etc/apache2/extra
(5) This file then includes all of the conf files from /private/etc/apache2/users rather than set a deny none on the directory pattern /Users/*/Sites.
(6) The users directory only contains a configuration file for the Guest account.

So it appears the thing to do in order to enable web browsing of my Sites directory is to do the following:

cd /private/etc/apache2/users
sudo cp Guest.conf me.conf
sudo ed me.conf
ed> s/Guest/me
ed> w
ed> q

This will create a configuration file for user ‘me’, and set the directory settings the same as for Guest. The ed commands are shown with the ed> prompt.

Once this is done, restart web sharing (I did it in the MacOS X System Preferences ‘sharing’ panel), and you should now be able to browse your Sites folder.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s