Sunday, 20 May 2012

Configuring virtual web with xampp

Introduction

Virtual Web comes in handy when you have multiple websites that you need to host and especially when you do not want to invest into hardware since your current hardware is good enough to host more than just one websites, and so why invest? Also, you will just need one public external ip address to do the job.

Setup steps

1. cd to /opt/lampp/etc and edit the file httpd.conf

2. Locate the word #Virtual host

3. Remove the # sign in front of  Include etc/extra/httpd-vhosts.conf

4. cd to directory /opt/lampp/etc/extra and edit the file httpd-vhosts.conf

5. Start adding the virtual site that you want to host by adding the following line after the NameVirtualHost *.80 line

<VirtualHost *:80>
    ServerAdmin webmaster@somedomain.com
    DocumentRoot /opt/lampp/htdocs/somedomain
    ServerName www.somedomain.com
    ErrorLog logs/somedomain.com-error_log
    CustomLog logs/somedomain.com-access_log common
</VirtualHost>



6. When this is done, goto /opt/lampp/htdocs and create a directory called somedomain this folder must match the name that you have entered earlier in the virtualhost file.

7. Copy a test html file to that directory or you can just copy and paste the following html code and save it as index.html

<html>
<head>
<title>       </title>
<style type="text/css">
<!--
h1 {text-align:center;
font-family:Arial, Helvetica, Sans-Serif;
}

p {text-indent:20px;
}
-->
</style>
</head>
<body bgcolor = "#ffffcc" text = "#000000">
<h1>Hello, World!</h1>
</body>
</html>

8. Restart lampp service by issuing the command /opt/lampp/lampp restart

9. Start testing by open up an internet browser and point it to the domain. For eg. http://www.somedomain.com



No comments:

Post a Comment