Home  |  Contact         

Zrinity is the leader in enterprise-class email marketing management solutions and content management solutions for marketing professionals and developers worldwide.
Products Services Solutions Support Resources Partners Company
HOWTO Setup Virtal Hosts (Multiple Web Sites) on Apache

Apache for Windows allows you to run multiple web sites with just one IP address. This is great for developers used to using IIS on Windows NT Workstation, or 2000 Professional, in those environments you are limited to only one web site.

To set up a virtual host the first thing you need to do is uncomment (pound signs # are comments in Apache conf files) the NameVirtualHost directive in the httpd.conf file (towards the bottom). Set this directive to be the IP address of your server.

NameVirtualHost 12.34.56.78

Next you will use the VirtualHost tag. This tag has will enclose many of the same directives that are found inside the httpd.conf file, directives like ServerName, DocumentRoot, and DirectoryIndex. lets look at an example Virtual host setup (add to the bottom of httpd.conf):

NameVirtualHost 12.34.56.78		

<VirtualHost 12.34.56.78>
	ServerName www.myvirtualhost.com
	ServerAlias myvirtualhost.com
	DocumentRoot d:/myvirtualhost.com/www
	DirectoryIndex index.cfm index.htm index.html
</VirtualHost>

<VirtualHost 12.34.56.78>
    ServerAdmin webmaster@myvirtualhost.com
    DocumentRoot w:/myvirtualhost.com/subdomain
    ServerName subdomain.myvirtualhost.com
    ErrorLog logs/subdomain-error.txt
    CustomLog logs/subdomain-access.txt common
</VirtualHost>
		
Note the use of the ServerAlias directive, it is used to allow you to specify multiple server names, useful for have www.site.com and site.com to be mapped to the same web site.

Apache Server Resource Center
Server Products




  
home products services partners company support contact
Copyright 2006 © Zrinity Inc. All rights reserved.     View our privacy policy         March 12, 2010