Setting Virtual Host Using Wamp


Step 1: -
Download and install WAMP, then start the program

Step2: -
Go to "C:/Windows/System32/drivers/etc" and open the "hosts" file in Notepad.

Step 3:-
At the bottom of the hosts file, below all the other text, add a new line with the following:  127.0.0.1   mysite.local    #My Test Site

(# symbol is used for comments)

Step 4-
Open "C:/wamp/bin/apache/Apache2.2.21/conf/" (your Apache version number may be different)- There will be 2 files - one called "httpd.conf", and one called "httpd.conf.build", Open "httpd.conf".

Step 5:-
There will be entry of "# Virtual hosts", uncomment (remove the hashtag [#]) the line below it: "Include conf/extra/httpd-vhosts.conf".This tells Apache to include the file "httpd-vhosts.conf" (the file where we set our virtual hosts) when configuring its settings.

Step 6:-
Go to "C:/wamp/bin/apache/Apache2.2.21/conf/extra" and open the file "httpd.vhosts.conf".

Step 7-
We need to give Apache permission to look in our "Projects" folder for websites. At the bottom of the page, below all the other text, add the following:

Order Deny,Allow   Allow from all 

Step 8:-
After the directory code you just added, add:

  DocumentRoot "C:\Users\Kristen\Documents\Projects\My Site" #It doesn't matter if you use forward or backslashesServerName mysite.local #This should be the same domain that you entered in your "hosts" file


- The DocumentRoot should be the path to the folder where your site lives, and the ServerName should match the domain you entered in your hosts file in Step 3.- Important: The DocumentRoot must be inside the directory that you gave Apache permission to access in Step 7.Save the file now

Step 9:-
Click on the green WAMP icon in your toolbar and select "Restart all Services", then wait for the icon to turn back to green.

Step 10:-
Open your browser and navigate to "mysite.local", or whatever your domain name is. You should see the test page you created in Step 1.


Note:
If you're going to be working on sites with custom .htaccess files, you'll need to set AllowOverride in Step 7:

AllowOverride AllOrder Deny,Allow   Allow from all 

Comments

Popular posts from this blog

Speed Up Browsing in FireFox

Learn Web Developing Courses for free ?

How To Publish Free Sites