Setting up Virtual Sites with Apache Web Server on Windows

This tutorial will guide you through installing Virtual Sites for Apache Web Server. This is applicable only if you planning to built your web application not from http://localhost.

Below listed are the series of steps that will allow you to add virtual sites:

Here i am trying to add dev.hiteshagrawal.com. Before doing this make sure to create a backup of the files that will be edited to create virtual site just in case if anything wrong happens to the system.





Step1 - Edit the Host File:

Example:
C:\Windows\system32\drivers\etc\hosts - Win98, WinXP, WinME
C:\WinNT\system32\drivers\etc\hosts - WINNT based OS

Step 2 - Update Apache Web Server Configuration File
The next step involves configuring Apache Web Server to know him that it also needs to accept requests for http://dev.hiteshagrawal.com.
Open the Apache Web Server configuration file (httpd.conf) located at “apache root folder/conf”.
Example if your Apache Web Server Folder is on C Drive then the path would be C:\Apache2.2\conf\httpd.conf

Now you need add the following code inside the httpd.conf file.

    <virtualhost *:80>
        DocumentRoot "/websites/hiteshagrawal.com"
        ServerName dev.hiteshagrawal.com
    </virtualhost>

Step 3 - Giving Permission to the Virtual Folder
Now you need add the following code inside the httpd.conf file

<directory "C:\websites\hiteshagrawal.com">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</directory>

Step 4 - Cross Check to validate your changes
Create a file index.php in the Virtual Directory folder. Open your browser and type in the domain that you configured and index.php.
Here http://dev.hiteshagrawal.com/index.php

Random Posts

Custom Search

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)