by Derek—2003.11.13 @ 0302
One of the cool things I've wanted to do is create "sub-domains" on a website. For example, http://services.bard.org. This works locally as well, and has been very nice for testing my designs and programs on OS X.
This note uses Apple's NetInfo Manager and the Terminal to edit Apache's configuration file (httpd.conf).
1. Open NetInfo Manager and browse to /machines/localhost
2. Click on the "lock" icon and enter your password to authenticate
3. Duplicate "localhost" (Edit > Duplicate)
4. Select this copy (e.g. "localhost copy") and then select the name property in the lower window
5. Change the value of "name" from "localhost" to whatever your development site will be (You can use bogus Top Level Domains)
6. Click on one of the other directories on the list and you will be prompted to "Save Changes." Click "Yes."
1. Open and edit httpd.conf
emacs /etc/httpd/httpd.conf
2. Near the end of the file you'll see the section on "VirtualHosts"
3. Make sure there is the default host alone for "localhost"
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot /usr/local/apache/htdocs
ServerName localhost
</VirtualHost>
4. Add your new VirtualHost
<VirtualHost 127.0.0.1>
DocumentRoot ... # Change to be site specific
ServerName dummy.site.com
...
</VirtualHost>