How To Setup An Apache Virtual Host

A Virtual Server or a Virtual Host is nothing but the mechanism of running more than one website and that too on a single machine. Virtual hosts are primarily of two types namely IP based and Name based. Whenever the concept of virtual hosts comes up, the decision is always incomplete if we don’t mention the contribution of Apache in the domain of virtual hosts and expansion of the World Wide Web. Apache in fact, was the first among its competitors to support virtual hosts of IP based type which came to be known as

Apache Virtual Servers.

Methodology of setting up an Apache Virtual Host

To set up an Apache Virtual host, first of all you need to install the software of Apache. Then editing a file named httpd.conf is required. The destination of this file is in the conf folder which is present in the Apache folder which again is present in the folder named Apache Group in the drive you did the installation. Let us assume that we have two domains named and and we have these sites in the primary drive of our hard disk and the destination is C:\Websites\ and C:\Websites\ It has to be kept in mind that you can have the name of your domain as anything you want.

After opening the httpd.conf file, proceed to the bottom of the file to find an example of a host which is virtual. The following lines should be written after the example:-



DocumentRoot “C:\Websites\x1”

ServerName x1.local



DocumentRoot “C:\Websites\x2”

ServerName x2.local


Click the save option and close the file. The above code snippet tells the apache virtual private server all about the pages of the domain x1.local and x2.local.

The next step is to resolve the issue of Domain Name System (DNS). If we don’t do this step then the DNS will never be able to find the domains when we enter the address www.x1.local or www.x2.local in our web browser. For this we need to change a file named hosts which is found in the etc folder which is present in the drivers folder which again is present in the system32 folder of the Windows registry. After opening the hosts file we again haave to go the bottom of the file and write two lines after the comment lines marked by the # symbol. The lines that need to be written are as follows:- x1.local x2.local

That’s almost done. Restarting the server is the last major step in this whole process.
You can do that from the Start menu. The direction is Start > Programs >Apache HTTP Server>
Control Apache Server > Restart. That will serve the job.

You can now easily by yourself install a virtual server at your home by referring to the
above tutorial. The above piece of writing has been written with utmost care and hope it
will serve the job of setting up a virtual Apache server as stated in the title efficiently.

Notice : This original article above is the property of ( Web Hostings review provides independent reviews of top 10 best web hosting providers online. five-star web hosting reviews, elite web hosting awards, web host ratings, reduced web hosting plans, all reviews create or internal ranking.

Requirement : You must post the author information above if you would like to republish this article!

Leave a Reply