আগামী ৩০ নভেম্বর-২০১৭ তারিখ থেকে শুরু হচ্ছে পাঁচ মাস ব্যাপী Professional Web Design and Development with HTML, CSS PHP,MySQL,JavaScript, AJAX, JQUERY, Bootstrap and Live Project কোর্সের ৮৭ তম ব্যাচ এবং ২৪ নভেম্বর-২০১৭ তারিখ থেকে শুরু হচ্ছে চার মাস ব্যাপী Zend PHP-7 Certified PHP Engineering (Advance PHP) কোর্সের ৩৫ তম ব্যাচ। প্রত্যেকটি কোর্স এর ফী নির্ধারণ করা হয়েছে ৩০,০০০/= আগ্রহীদেরকে অতিসত্বর মাসুদ আলম স্যার এর সাথে যোগাযোগ করতে অনুরোধ করা যাচ্ছে। স্যার এর মোবাইল: 01722 81 75 91

Create and Setup Unlimited Virtual Host in your WAMP Server

virtual_hosts_diagram_1

Setup Unlimited Virtual Host in your WAMP Server

To set up a virtual host and a local domain, follow the steps mentioned below:

Step 1:  In folder C:/wamp/www on computer1, we now create 3 folders associated with domain and 2 subdomains as follows:
C:/wamp/www/domain
C:/wamp/www/sub1
C:/wamp/www/sub2

Step 2:  In each folder, we create folder logs to store the log files, and make sure to have these logs folders in place or your wamp will not run:

C:/wamp/www/logs
C:/wamp/www/domain/logs
C:/wamp/www/sub1/logs
C:/wamp/www/sub2/logs

Step 3: open file httpd.conf in folder C:\wamp\bin\apache\apache2.2.6\conf and find these lines:

 # Virtual hosts
 #Include conf/extra/httpd-vhosts.conf
 

Step 4:  uncomment the second line, and make sure there is no blank space in front of second line and in the end of first line or your wamp will not run:

 # Virtual hosts
 Include conf/extra/httpd-vhosts.conf

Step 5:  open file httpd-vhosts.conf in folder C:\wamp\bin\apache\apache2.2.6\conf\extra, delete everything in there and replace with these codes below. Make sure to put your main site on very first and localhost in very last.

NameVirtualHost *:80
 <VirtualHost *:80>
 ServerName <a href="http://www.domain.com" target="_blank">www.domain.com</a>
 ServerAlias domain.com domain
 DocumentRoot C:/wamp/www/domain
 ErrorLog C:/wamp/www/domain/logs/error.log
 CustomLog C:/wamp/www/domain/logs/access.log common

</VirtualHost>
 <VirtualHost *:80>
 ServerName sub1.domain.com
 ServerAlias sub1
 DocumentRoot C:/wamp/www/sub1
 ErrorLog C:/wamp/www/sub1/logs/error.log
 CustomLog C:/wamp/www/sub1/logs/access.log common
 </VirtualHost>

<VirtualHost *:80>
 ServerName sub2.domain.com
 ServerAlias sub2
 DocumentRoot C:/wamp/www/sub2
 ErrorLog C:/wamp/www/sub2/logs/error.log
 CustomLog C:/wamp/www/sub2/logs/access.log common
 </VirtualHost>

<VirtualHost *:80>
 ServerName localhost
 DocumentRoot C:/wamp/www
 ErrorLog C:/wamp/www/logs/error.log
 CustomLog C:/wamp/www/logs/access.log common
 </VirtualHost>
 

Step 6:  open file “hosts” in folder C:/Windows/System32/drivers/etc on computer1; then, delete and replace those dummy codes with these codes:

 127.0.0.1 localhost
 127.0.0.1 domain
 127.0.0.1 sub1
 127.0.0.1 sub2
 

Step 7:  Now, you can access the domain on your local system as

http://domain
http://sub1
http://sub2
http://localhost

Hi, My name is Masud Alam, love to work with Open Source Technologies, living in Dhaka, Bangladesh. I graduated in 2009 with a bachelor’s degree in Engineering from State University Of Bangladesh, I’m also a Certified Engineer on ZEND PHP 5.3, I served my first five years a number of leadership positions at Winux Soft Ltd, SSL Wireless Ltd, CIDA and MAX Group where I worked on ERP software and web development., but now i’m a co-founder and Chief Executive Officer and Managing Director of TechBeeo Software Consultancy Services Ltd. I’m also a Course Instructor of ZCPE PHP 7 Certification and professional web development course at w3programmers Training Institute – a leading Training Institute in the country.

2 comments on “Create and Setup Unlimited Virtual Host in your WAMP Server
  1. Thank you Masud for this great tutorial, looking forward to read more of yours articles.
    Virtual hosts are up and running, if anyone ask.

Leave a Reply

Your email address will not be published. Required fields are marked *