No public Twitter messages.
Jan, 2010
20

Setting up a localhost subdomain in OS X Leopard (Made Easy)

Hello All, its been a while since I made an update and I am really only posting this because I keep forgetting what files to modify when I go to setup a new localhost subdomain.

So here it is..

Step 1) Setup your new subdomain path as a virtual directory in apache. This file lives at /etc/apache2/other/httpd-vhosts.conf

Add an entry..

DocumentRoot "/wwwroot/yoursubdomainpath/"
ServerName yoursubdomain.localhost

This should immediately follow the virtual host setup for localhost.

Step 2) Add an entry to your hosts file located at /etc/hosts

It probably looks like this to start.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost
fe80::1%lo0    localhost

Just add this line to the end of the file.. It is important to know that it is tab delimited not spaces.

127.0.0.1   yoursubdomain.localhost

The only other thing you may need to do if it wasn’t already done is uncomment this line in your /etc/apache2/httpd.conf file

Include /private/etc/apache2/extra/httpd-vhosts.conf

It lives around line 461

Thats it! Restart apache and yoursubdomain.local host now works.

Post to Twitter Tweet This!

This entry was posted on 01.20.2010 at 5:41 am and is filed under Unix Pie. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Comments

Leave a Reply

Green Web Hosting! This site hosted by DreamHost.