Setting up virtual host on WAMP server

0 / 2371
Setup virtual host on WAMP server
In continuation to previous blog here, this blog will show, how you can setup a virtual host on WAMP server in 3 simple steps. 

Why setup a virtual host on WAMP server

  1. It gives simpler, cleaner and easy to remember URLs like we have for public websites.
  2. Mapping permissions to different IP addresses becomes easier.
 

3 simple steps to setup virtual host on WAMP

  1. First step is to edit httpd.conf file which is located in wamp\bin\apachex.x.xx\conf directory and search for vhost_alias and Virtual hosts and make sure the below lines following each of those options are commented:LoadModule vhost_alias_module modules/mod_vhost_alias.soInclude conf/extra/httpd-vhosts.conf.This is shown in screenshot below:screen1screen2
  2. Second step is to go to C:\windows\system32\drivers\etc directory and add the following lines to your hosts file: 127.0.0.1 sydney-home 127.0.0.1 sydney-home.com 10.0.0.28 sydney-home 10.0.0.28 sydney-home.com 127.0.0.1 sydney-home.local 127.0.0.1 www.localhost.com 127.0.0.1 localhost 127.0.0.1 localhost.com    In this case, sydney-home is the name of my virtual host. Please replace it accordingly as per your virtual host name chosen by you.
  3. The last step is to edit the httpd-vhosts.conf file and add the below code to it:- <VirtualHost *:80> ServerAdmin webmaster@sydney-home.com DocumentRoot “c:/wamp/www/” ServerName sydney-home.local ServerAlias www.sydney-home.local ErrorLog “logs/sydney-home.com-error.log” CustomLog “logs/sydney-home.com-access.log” common <Directory “c:/wamp/www/”>     Options Indexes FollowSymLinks     AllowOverride all     Order Deny,Allow     Deny from all Allow from 127.0.0.1 ::1 </Directory> </VirtualHost> at the end of the file.This file can be found at location : wamp\bin\apache\apachex.xx.xx\conf\extra\httpd-vhosts.conf.
Once the above steps are done, you are all set to go. Just Restart your wamp by selecting Restart all services as shown in screenshot below. Once wamp logo shows green. Goto the browser and you can access your wamp with urls like http://<your_hostname>, localhost.com, localhost and so on… wamp_restart     Below is a small video explaining the same above steps:       Please like our page, and subscribe to our blog if you enjoy reading our articles. Comments/suggestions, always welcome. Stay tuned for more.

Comments

comments


An avid reader, responsible for generating creative content ideas for golibrary.co. His interests include algorithms and programming languages. Blogging is a hobby and passion.

Related Posts