Page 1 of 1

Vhosts - Multiple websites

PostPosted: 02. March 2008 15:59
by joldas
Hello to all!

Im new to the forum - Been using xampp for 3-4 months now and as i became more experienced, i thought, how about hosting multiple websites.

I'm hosting my website (works fine) at my home (XP SP2 Box), just by using xampp.

The domain i have is hosted at DynDNS.com, free account.
My mate wanted to make a website for him, so i thought I could host it for him.

My DynDNS.com domain is http://www.joldas.ath.cx
and i wanted to make one for him -> http://www.yiouldassis-stratos.ath.cx

So, i searched google, how to add multiple websites.
I found different topics on this forum, added the virtual hosts on my vhosts file but it seems that there is a small problem.

First, let me explain you, what's the directories

F:/var/ -> Xampp Folder
F:/var/htdocs/ ->Documentroot Folder

F:/var/htdocs/vhosts/ -> Vhosts folder (for both domains)

F:/var/htdocs/vhosts/joldas_ath_cx/ ->Folder for my domain

F:/var/htdocs/vhosts/yiouldassis-stratos_ath_cx ->Folder for my friends domain

*******I LEFT THIS LIKE IT WAS********

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80

***********************************


So, i added these lines to my vhosts file :

<VirtualHost *:80>
ServerAdmin user@joldas.ath.cx
DocumentRoot "F:/var/htdocs/vhosts/joldas_ath_cx"
ServerName joldas.ath.cx
ServerAlias www.joldas.ath.cx
ErrorLog @rel_logfiledir@joldas.ath.cx-error_log
CustomLog @rel_logfiledir@joldas.ath.cx-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin user@yiouldassis-stratos.ath.cx
DocumentRoot "F:/var/htdocs/vhosts/yiouldassis-stratos_ath_cx"
ServerName yiouldassis-stratos.ath.cx
ServerAlias www.yiouldassis-stratos.ath.cx
ErrorLog @rel_logfiledir@yiouldassis-stratos.ath.cx-error_log
CustomLog @rel_logfiledir@yiouldassis-stratos.ath.cx-access_log common
</VirtualHost>

In both folders, I added a simple index.html only to see if it does the routing correctly

Restarted apache and tried them...
I typed in my browser http://www.joldas.ath.cx/ and the it showed me the contents of F:/var/htdocs/vhosts/joldas_ath_cx

But, when i typed http://www.yiouldassis-stratos.ath.cx it showed me again the contents of
F:/var/htdocs/vhosts/joldas_ath_cx

instead of the contects of F:/var/htdocs/vhosts/yiouldassis-stratos_ath_cx

So, i believe that there is a problem with the configuration...
Or, with the DNS? I really have no idea.

Some more info...

My internet Connection is a PPPoE - Dialup Broadband Internet
Dynamic IP address Assignement - DHCP cares for the box that has the xampp server installed. Static Lan IP address - Ports are forwarded successfully...

Ask me everything you need to know, so you could help me out!
Thanks in advance...

PostPosted: 02. March 2008 17:25
by Scory
>##NameVirtualHost *:80

Why didn't you un-un-comment that?

There is a great doc for virtualhost on Apache website: http://httpd.apache.org/docs/2.2/en/vhosts/

Regards
Scory

PostPosted: 02. March 2008 17:37
by joldas
OOOoooo Nice!!!

I did what you told me. But, basically, i went to http://httpd.apache.org/docs/2.2/vhosts/
and saw the apache reference too.

I copied the script that they had there and typed these:

NameVirtualHost *

<VirtualHost *>
ServerName http://www.joldas.ath.cx
DocumentRoot "F:/var/htdocs/vhosts/joldas_ath_cx"
</VirtualHost>

<VirtualHost *>
ServerName http://www.yiouldassis-stratos.ath.cx
DocumentRoot "F:/var/htdocs/vhosts/yiouldassis-stratos_ath_cx"
</VirtualHost>

Now, everything works just fine!!! Thanks for your time!

Appreciated a lot!