Sunday, June 22, 2014

Hosting multiple websites in one windows server with Apache (VirtualHost)

To host multiple websites in one windows server with Apache is known  VirtualHost.
Here is the way to do.
In root create different folder according site name.
Example for domain www.mysite.com create folder "mysite"
Example for domain www.yoursite.com create folder "yoursite"
First of all need to go this path "apache/config" folder then open httpd file.

add following code end of the file.

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin winsharif@gmail.com
    DocumentRoot "C:\xampp\htdocs\mysite"
    ServerName mysite.com
    ServerAlias www.mysite.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin winsharif@gmail.com
    DocumentRoot "C:\xampp\htdocs\yoursite"
    ServerName yoursite.com
    ServerAlias www.yoursite.com
</VirtualHost>

Restart your apache and you'r done.
For more visit apache site  http://httpd.apache.org/docs/2.2/vhosts/examples.html

Total Pageviews