jwallace.us

tech, tunes, and other stuff

Developing With Apache in OSX

This works for both Leopard (10.5) and Snow Leopard (10.6).  There are a couple of things you need to do.  First you need to make it so Apache will serve up web  documents from your Sites folder.  Next you need to set up virtual hosting.  Here’s how to do both .

Go into the /etc/apache2/users directory & using sudo create a .conf file for your user account.  If your username is geronimo, then enter this into geronimo.conf:

1
2
3
4
5
6
<Directory "/Users/geronimo/Sites/">
   Options Indexes MultiViews
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

Now, in order to add virtual hosting.  Lets assume you want to name your virtual host local.me, add this next:

1
2
3
4
5
NameVirtualHost *:80
<virtualhost *:80>
   DocumentRoot /Users/gerinomo/Sites/local.me
   ServerName local.me
</virtualhost>

Next, you’ll need to edit the /etc/hosts file and add this line:

127.0.0.1       local.me

Thats it.  Just restart apache & you’re done.  You’ll now be able to serve up web docs located in your Sites/local.me folder at http://local.me