How to setup WAMP virtual hosts

In this tutorial, I will be showing how to install WAMP or port 8080 (default port is 80) and how to setup WAMP. For me basically everything went fine. The problem I encountered was when setting up the virtual hosts. Download WAMP here and Install. Use a good text editor such as Sublime Text

1. Navigate to C:wampbinapacheapache2.4.9confhttpd.conf and edit lined no 513, simply remove # sign in front of the line. This will enable virtual hosts

Include conf/extra/httpd-vhosts.conf

2. Navigate to line 240 and change the code as follows (change denied to granted). This will fix the issues you might encounter later when setting up virtual sites.

<Directory />
AllowOverride none
Require all granted
</Directory>

3. Edit Line 62 and 63, change ports to 8080 (default is 80)

Listen 0.0.0.0:8080
Listen [::0]:8080

4.  Now goto C:wampbinapacheapache2.4.9confextrahttpd-vhosts.conf and edit/copy the following code. Make this file minimal as possible to avoid errors. Remove log files and other dummy email address.

<VirtualHost *:8080>
DocumentRoot “D:/Projects/website”
ServerName localsite
ServerAlias http://www.localsite
</VirtualHost>

<VirtualHost *:8080>
DocumentRoot “C:/wamp/www”
ServerName localhost
</VirtualHost>

5. Now start WAMP. You can do it from command prompt

net start wampapache

6. Access the site localsite:8080 (do NOT forget the port)

7. Make sure you have made an entry in Windows host file (location: C:WindowsSystem32driversetchost) as such

127.0.0.1       localhost
127.0.0.1         localsite

If you get any error, reply in the comment below

 

Advertisements
This entry was posted in Tutorials/Tips and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s