simple tutorial to setup multiple virtual hosts in windows using Wamp server.
Host fle codings looking like this
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 188.8.131.52 rhino.acme.com # source server # 184.108.40.206 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost
add this lines at end of the file.
127.0.0.1 mysite.local #My Test Site
and save this file.
You can find “httpd.conf”
Open “httpd.conf” using any code editor.
# Virtual hosts
# Virtual hosts #Include conf/extra/httpd-vhosts.conf
Uncomment the line to remove # symbol like this
# Virtual hosts Include conf/extra/httpd-vhosts.conf
It make Apache include “httpd-vhosts.conf” file.
Go to “C:wampbinapacheApache2.4.4confextra” location.
Open “httpd.vhosts.conf” using any code editor.
add this line to allow
<Directory /wamp/www/MyProject/> Order Deny,Allow Allow from all </Directory>
It provide Apache permission to access the filder
Next add this lines
<VirtualHost *:80> DocumentRoot "C:/wamp/www/MyProject/" ServerName mysite.local </VirtualHost>
ServerName match the domain name you previously entered in Host file.
Restart WampServer using
Click “Show Hidden icons” in Windows Task bar. Left click green WampServer icon. Click “Restart All Services” option.
That’s all. Now type “http://mysite.local/ in your browser.