![]() |
![]() |
Internal
External
Affiliates
- CSForge
- Free Information Society
- Neil Bittner [Dot] Com
- Esoteric Press
- Paul Harvey The Game
- Inman's Total Electronics
- Become an Affilate...
Quick Links
Search Google
Back to Articles
Setting up Apache Virtual Host in Windows
Many times when I am doing web development on my laptop I have a need for more than one site. By using virtual servers I can add as many virtual sites to my computer as I want. This tutorial walks you through how to set up virtual webservers in Apache using Windows
- Begin by opening the httpd.conf configuration file in your apache/conf directory.
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:/web1"
ServerName site1
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot " C:/web2"
ServerName site2
</VirtualHost>
- Save and close the file.
- Open Window's hosts file in a text editor (on XP it is located at C:\WINDOWS\system32\drivers\etc).
- Edit the file so your computer will be able to resolve the server names
(add the new server names right below the localhost entry)
127.0.0.1 localhost
127.0.0.1 site1
127.0.0.1 site2 - Save and close the file.
- Restart Apache (using the command line: C:\apache\Apache.exe -w -n "Apache" -k restart).
- Then you can access you servers through a webbrowser.
| Posted by | eli |
| Author | Eli N. |
| Date | 06-01-2006 10:03pm |
| Updated | 06-01-2006 10:26pm |
| Views | 852 |
| Average rating | Not yet rated |

