Virtual host configuration for Apache
Apr 23, '01 07:59:59AM
Contributed by: Anonymous
From the editor: Would you like the ability to easily access web sites you set up by name, instead of by number? If so, you'll want to use Virtual Hosts in Apache which will let you do just that. Read the rest of the article for jaccorens' instructions on how to configure it. I have not done this yet on my machine, but intend to ... someday when I get some free time!
Here's how to add some named localhosts to your OS X setup:
- open the NetinfoManager and become admin under the domain menu > security > authenticate.
- duplicate the localhost entry under the machines entry
- rename this copy to your prefered sitename (www.yoursitename1.dev), I used ".dev" because it's not used on the internet!
- open your terminal.app and SU to root
- type 'open -e /private/etc/httpd/httpd.conf' (without the quotes)
- find "#NameVirtualHost" in httpd.conf file
- change this into: "NameVirtualHost *" (remove the # and add the *, don't type the quotes)
- at the end of the file, make an entry like this:
<VirtualHost *>
DocumentRoot /Library/WebServer/www.yoursitename1.dev
ServerName www.yoursitename1.dev
</VirtualHost>
- in your /Library/WebServer/ folder, make an folder named like above (www.yoursitename1.dev)
- want more virtual hosts? do step 2 & 3 (www.yoursitename2.dev, www.yoursitename3.dev enz..)
- repeat step 8 & 9
works here, questions.. feel free :-)
Comments (11)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20010423075959611