Sunday, March 16, 2014

How to create Virtual Host on Apache Server (using uWamp and XAMPP)


-----
How to create Virtual Host on Apache Server (using uWamp and XAMPP)

INTRODUCTION

Virtual hosting is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers). This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same host name. The term virtual hosting is usually used in reference to web servers but the principles carry over to other internet services. (Read more on Wikipedia).
This tutorial uses UwAmp server package as a starting point for a person to learn about Virtual Host. After that, the person would be able to apply it on XAMPP.

STEPS

1) Download UwAmp from http://www.uwamp.com/file/UwAmp.zip  (this tutorial uses version 2.2.1)
2) Extract the zip to C Drive, ie C:\UwAmp\
3) Go to the folder and run UwAMP.exe.
4) Under the Configuration section, click Apache Config button.
5) Under the Virtual Server list, click the item “www.example.com *:80” (this is a sample)
6) Under Virtual Server details, edit as follows. Click OK.

7) Exit UwAmp Control Panel.
8) In File Explorer, create a new folder C:\UwAMP\example.

9)  Inside the folder “example”, create index.php containing the following codes:
<?php
echo "Hello Example";
?>
10) Edit the file C:\Windows\System32\Drivers\etc\hosts by adding the name www.example.local.
11) Restart Windows.
12) Run UwAmp.
13) Browse URL http://www.example.local
14) In the UwAmp Control Panel, under the Configuration section, click the Source Code button.
15) The Notepad program automatically opens the httpd_uwamp.conf file.
Scroll to the end of the file to find the VirtualHost Directives.


16) Refer tutorial http://secure-steps.blogspot.com/2014/03/how-apache-and-php-works.html. Can you apply the codes in Step 15 to this XAMPP15 server? This time change the output to “Hello Xample”.


No comments:

Post a Comment