Setting up Virtual Host in Local machine (Wamp Server)

Hi !!!

Today i am going to share how to set up the virtual host in local machine with the Apache Server.  In my tutorial i have used WAMP server.

What is Virtual Host?

Virtual Host is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers). This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same host name.

How to setup Virtual Host in Server?

1. Add Host to your Hosts file. For adding you have to locate below file,
C:\Windows\System32\drivers\etc\hosts
Open "hosts" file in notepad and add below line after 127.0.0.1 Localhost

127.0.0.1       yourwebsite.local

Here "yourwebsite.local" will point to your server on local machine.

2. Next step is to enable vhosts in apache. Open your httpd.conf file which is located under,
C:\wamp\bin\apache\apache2.2.22\conf 

Here, You have to uncomment below line in httpd.conf file,
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

3. Next step is to setup the Host in APACHE server.
Open your httpd-vhosts.conf which is located under,
C:\wamp\bin\apache\apache2.2.22\conf\extra

Here, you have to add  HOST Server.

<Directory C:/wamp/www/projectfolder>
Order Deny,Allow   
Allow from all 
</Directory>

<VirtualHost *:80>   
DocumentRoot "C:/wamp/www/projectfolder
ServerName youwebsite.local
ServerAlias www.yourwebsite.local
</VirtualHost>

How to Setup Virtual Host in Local machine without APACHE?


1. Add Host to your Hosts file. For adding you have to locate below file,
C:\Windows\System32\drivers\etc\hosts
Open "hosts" file in notepad and add below line after 127.0.0.1 Localhost

192.168.101.1       yourwebsite.local

Here "yourwebsite.local" will point to shared server  with the shared IP address.

2. Open your browser type yourwebsite.local. It will start work. Thats it!!!!

Hope you enjoyed the tutorial!! Please dont hesitate to share your comments!!! :)



Comments

Popular posts from this blog

Ghostscript Installation and Configuration in Windows 7

Joomla - Get user id