Apache is a powerful and flexible HTTP/1.1 compliant
  	web server.  Originally designed as a replacement for the NCSA HTTP
  	Server, it has grown to be the most popular web server on the
  	Internet.  As a project of the Apache Software Foundation, the
  	developers aim to collaboratively develop and maintain a robust,
  	commercial-grade, standards-based server with freely available
  	source code.
	
  
	The Apache HTTP Server is distributed at no charge for
	commercial or non-commercial use. For more information read the LICENSE.txt file.
	
  
	Apache can be used with Microsoft Windows. The
	Apache HTTP Server Version 2.0 runs under Windows NT, Windows 2000 and
	Windows XP. You should download the version of Apache for Windows with
	the .msi extension. This is a single Microsoft Installer file containing Apache,
	ready to install and run.
	
  
	The latest Apache HTTP Server version can be downloaded from:
	http://httpd.apache.org/
	 
	The latest Apache 1.3 documentation can be found at:
	http://httpd.apache.org/docs/1.3/ 
	The latest Apache 2.0 documentation can be found at:
	http://httpd.apache.org/docs/2.0/ 
	The latest Apache 2.2 documentation can be found at:
	http://httpd.apache.org/docs/2.2/
		
  
	
	
	
	
	
	 
	
	
 
  
	 
	
 
  
		
	
	
	Apache 2.0.49: Host two domains using name-based virtual hosting.
	
  
	Information 
	none
	
  
	Operating system used 
	Windows XP Home Edition Version 5.1 SP 2
	
  
	Software prerequisites 
	Apache 2.0.49
	
  	
	Procedure
	
	- Lets assume you have two domain names and one ip address, e.g.:
		
  
			
		
		
			
			
		 
		
			| 
				192.168.1.100
			 | 
			
				http://www.mobilefish.com
			 | 
		 
		
			| 
				192.168.1.100
			 | 
			
				http://www.abcxyz.com
			 | 
		 
			 	
		
		 
	 	and you want to host both domains on the same web server by using
		name-based virtual hosting.
		
  
		To serve your webpages by Apache, first create two DocumentRoots
		from which you will serve your web pages.
		As an example, create the following directories:
		
  
		
		- c:\mobilefish_web (for www.mobilefish.com)
 
		- c:\abcxyz_web (for www.abcxyz.com)
 
		 
		 
		and put all your webpages in their respective directories.
		
  
	 
	- Add and change the following lines in the
 
	    C:\Tools\Apache Group\Apache2\conf\httpd.conf file, e.g.:
		
  
		
		Listen 80
		
  
		ServerAdmin [email protected]
		
  
		ServerName www.mobilefish.com:80
		
  
		DirectoryIndex index.html index.html.var index.shtm index.htm
		
  
		NameVirtualHost 192.168.1.100
		
  
		<VirtualHost 192.168.1.100:80> 
		   ServerAdmin webmaster@mobilefish.com 
		   DocumentRoot c:/mobilefish_web 
		   ServerName www.mobilefish.com 
		   ErrorLog logs/www.mobilefish.com-error_log 
		   #TransferLog logs/www.mobilefish.com-access_log 
		   CustomLog "|c:/weblogs/rotatelogs.exe  
		      c:/weblogs/www.mobilefish.com-access_%y%m%d.log 86400" combined  
		   <Directory "c:/mobilefish_web">	 
		      	Options +Includes 
		      	AddType text/html shtm 
		      	AddOutputFilter Includes shtm 
		   </Directory> 
		</VirtualHost>
		
		
  
		
		<VirtualHost 192.168.1.100:80> 
		   ServerAdmin webmaster@abcxyz.com 
		   DocumentRoot c:/abcxyz_web 
		   ServerName www.abcxyz.com 
		   ErrorLog logs/www.abcxyz.com-error_log 
		   #TransferLog logs/www.abcxyz.com-access_log 
		   CustomLog "|c:/weblogs/rotatelogs.exe  
		      c:/weblogs/www.abcxyz.com-access_%y%m%d.log 86400" combined  
		   <Directory "c:/abcxyz_web">	 
		      	Options +Includes 
		      	AddType text/html shtm 
		      	AddOutputFilter Includes shtm 
		   </Directory> 
		</VirtualHost>
		
		
  
		View the updated httpd.conf file.
		
  
				
		
		
			
			
		 
		
			| 
				Listen
			 | 
			
				The Listen directive is required and listens to only specific IP addresses or ports.
			 | 
		 
		
			| 
				ServerAdmin
			 | 
			
				Email address that the server includes in error messages sent to the client.
			 | 
		 
		
			| 
				DocumentRoot
			 | 
			
				This directive sets the directory from which httpd will serve files.
			 | 
		 
		
			| 
				ServerName
			 | 
			
				Hostname and port that the server uses to identify itself.
			 | 
		 
		
			| 
				DirectoryIndex
			 | 
			
				If you use index.shtm or index.htm pages you must change the DirectoryIndex
				directive.
			 | 
		 
		
			| 
				NameVirtualHost
			 | 
			
				The NameVirtualHost directive is a required directive if you want to configure
				name-based virtual hosts.
			 | 
		 
		
			| 
				Directory
			 | 
			
				The Directory directive "<Directory>" is included in
				this example if you want to use Server Side Includes (SSI).
			 | 
		 
		
			| 
				CustomLog
			 | 
			
				The CustomLog directive is added to rotate the logfiles. To make this work you MUST
				also do the following:
				
  
				
					- Create a directory to store the log files, for example: c:\weblogs
 
					- Copy the file C:\Tools\Apache Group\Apache2\bin\rotatelogs.exe
						to c:\weblogs. If you do not do this the log files are NOT created.
					
 
				 
			 | 
		 
		
			| 
				TransferLog (commented out)
			 | 
			
				In this example the TransferLog directive is commented out, the CustomLog
				directive is used instead. If you do not want to rotate the log files
				comment out CustomLog and uncomment TransferLog.
			 | 
		 
			 	
		
		
  
	 
	- Verify if the file httpd.conf is correctly modified:
		
  
		C:\Tools\Apache Group\Apache2\bin\apache -t
		
  
		You should see the following:
		
  
		
		Syntax OK
		
		
  
		
	
	
  
 
	 
	- After httpd.conf is changed, always restart Apache.
		
  
	 
	- If you do not have a DNS server, you can modify file:
 
		c:\windows\system32\drivers\etc\hosts 
		Add the following lines:
		
  
		 192.168.1.100	    www.mobilefish.com 
		 192.168.1.100	    www.abcxyz.com
		
  
		And disable Proxyserver in IE browser setting:  
		Extra | Internet-options | Connections | LAN-settings |
		
  
	 
	- Now you can access both websites by their domainname, i.e.: 
 
		http://www.mobilefish.com 
		http://www.abcxyz.com 
		 
			
	 
	
	 
	
	 
	
	 
	 
	 
	 
	 |  
		 	
		
	
	 |