Tuesday 29 January 2013

Configure a virtual host using XAMPP in windows


In this post you are going to learn how to configure a virtual host from a windows environment using XAMPP. XAMPP is pretty popular for all apprentices who really wanna learn their trade and it can’t get better than even having you own host instead of having to place everything  inside the htdocs folder. 
What do we mean by virtual host? Think of it as this , when you do domain name registration you start by doing a search to make sure that the name you look for is not taken. After you are successful then the next step involves getting a suitable host where your web application files will reside. In this post  we combine both those processes into one but only on your development machine.

1. Edit the file httpd-vhosts.conf found at the directory C:\xampp\apache\conf\extra.  Insert the following configuration script. 
<VirtualHost www.thetaitanstore.com:80>
    ServerAdmin admin@thetaitanstore.com
    DocumentRoot "D:\Virtual Sites hosted here\thetaitanstore"
    ServerName www.thetaitanstore.com
    ServerAlias thetaitanstore.com

   
    CustomLog "D:\Virtual Sites hosted here\thetaitanstore\logs\access" common

    <Directory />
           Options FollowSymLinks
           AllowOverride None
    </Directory>
    <Directory "D:\Virtual Sites hosted here\thetaitanstore">
           Options Indexes FollowSymLinks MultiViews
           AllowOverride FileInfo
           Order allow,deny
           allow from all
    </Directory>
</VirtualHost>

2. Since we now have told Apache that we have a new site we are hosting let tell the connections controller that if we type the address www.thetaitanstore.com the browser wont try to somewhere on the internet but just redirect around the localhost. This is done by editing the hosts file.  Its located in this path

C:\Windows\System32\drivers\etc

Insert the entry 

127.0.0.1  www.thetaitanstore.com

3. Now go on and restart Apache from services to detect the configuration changes. 

In the next post we will talk about how we can make this virtual host to support SSL(Secure Sockets Layer) communications. 


No comments:

Post a Comment