Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: How to set up a wildcard DNS' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: How to set up a wildcard DNS
Authored by: tim-wood-MacOSXH on Nov 09, '05 02:09:43PM

For those who want to create a directory (say www.bob.dev) and have it automagically become a website (say http://www.bob.dev) without apache configuration, this worked for me under 10.3.9.


Create a directory to hold the automagically created sites. I put one in /Library/WebServer/Hosts. From the command line:
> sudo mkdir -p /Libarary/WebServer/Hosts

edit /etc/httpd/httpd.conf

First, you need to uncomment this section:
#LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so

Uncomment this one too:
#AddModule mod_vhost_alias.

And turn off canonical names
# UseCanonicalName Off

Then add these lines. The first part (/Libarary/Webserver/Hosts) should be the folder you created above:
VirtualDocumentRoot /Library/WebServer/Hosts/%0/Documents
VirtualScriptAlias /Library/WebServer/Hosts/%0/CGI-Executables

Then, restart apache
> sudo apachectl graceful

I've seen some notes to the effect that if you restart it using system prefs, you're changes will disappear in a puff of magical computer smoke.

You'll still need to tell your mac where 'www.bob.dev' is actually located. For me (10.3.9), I can just add a line to the end of /etc/hosts like this:

127.0.0.1 www.bob.dev

In the FWIW category, I change .com/.net/org to .dev for my dev copies so it's pretty clear whether I'm hitting the live or dev version.

The official resource on this is http://httpd.apache.org/docs/1.3/mod/mod_vhost_alias.html.

Enjoy!



[ Reply to This | # ]
10.4: How to set up a wildcard DNS
Authored by: ManxStef on Nov 17, '05 02:40:58PM

Sorry I'm so late getting on to this topic, and I'm not sure if this is quite what you're looking for, but I found it absolutely perfect for my purposes:
http://www.patrickgibson.com/utilities/virtualhost/

(It's a script that uses NetInfoManager and lets you easily create a named virtual host that is only accessible locally -- ideal for multiple local website development!)



[ Reply to This | # ]