-   Linux - Networking (
-   -   Multiple Web sites on home server (

pk_fox 08-18-2004 05:44 AM

Multiple Web sites on home server
Hello All, I'm sure this question has been asked before but please bear with me, I've set up a very basic web site on my home pc, the OS is Fedora Core 2 and the web server Apache, as I have a dynamic ip I use to map my ip to, all this works fine. What I would like to do is set up another site on the same server. I've looked at virtual hosts but I confess I don't really understand them.

For example ( these are fictitious domain names ) my site at the moment is accessed thus "", if I created a virtual host called "", how would I access it from the web ? would it become "" ?, as you can tell I need help, all help gratefully received


Pete Kane

bruno buys 08-18-2004 06:54 AM

One easy way to do this is to create a subdir under your /htdocs (If I recall well) and build the new site.
So, your address will be:

When someone hits this address, Apache will give him the index.html page inside /newsite. Or index.php, if you have it, of course.

bruj3w 08-18-2004 07:15 AM

virtual hosts can be confusing.

say in the dns system there's two domain names that point to the same ip, like in your example the domain names and, point to your ip.
so when you ping, make a http request or whatever else to either of those domain names they goto the same box...

when apache gets a request it will look at the destination field in the packet header. so for example if the destination is it will return the document from /var/www/site1 and if its from it will return the document from /var/www/site2.

edit your httpd.conf so it looks something like this

NameVirtualHost *

<VirtualHost *>
DocumentRoot /whatever/site1

<VirtualHost *>
DocumentRoot /whatever/site2

easy as.

i hope that didnt sound patronising, it didnt mean to.

good luck anyway.

pk_fox 08-18-2004 07:22 AM

thanks for your reply, but how do I access these other sites from the Web ?, is accessible because it's registered with, if I follow your example can I just enter ? where will the DNS be resolved?


Pete Kane

bruj3w 08-18-2004 07:25 AM

you'll have to register with dyndns as well. just point it to the same ip that is pointing too.

if your using the static dns thing you'll have to wait a while for it to work.

pk_fox 08-18-2004 07:34 AM

all is now clear, thank you very much for your time


Pete Kane

pk_fox 08-18-2004 08:44 AM

Hello again, I've registered my new site with, set up the virtual hosts and restarted apache BUT!, the only site that is found is the first one listed in the virtual list, if I set DocumentRoot to anything other than /var/www/html I get the default Apache welcome page ! any ideas ?


Pete Kane

bruj3w 08-18-2004 09:56 AM

can you post the urls of the two sites please?

i know very little about apache, having not used it much. you could try deleting the default apache page... and have you got a html file in the directory the second site is pointing to?

theres extensive documentation on this sort of thing if you google, should be able to find something :>

pk_fox 08-18-2004 10:01 AM

as requested

1) - this works

2) - this one returns index file not found ( error 403 )


Pete Kane

bruj3w 08-18-2004 11:21 AM

i get the apache test page up...

To prevent this page from ever being used, follow the instructions in the file /etc/httpd/conf.d/welcome.conf.

pk_fox 08-19-2004 04:36 AM

my point is , the welcome page should only display when Apache doesn't find a valid index.html file - which is present in the DocumentRoot directive, thanks for your efforts I'll keep you posted as and when I suss it out


Pete Kane

my DocumentRoot is a subdirectory of /var/html/

pk_fox 08-19-2004 05:38 AM

Hello again, I've finally got it working, turned out that the directory specified in DocumentRoot must be executable, I noticed this when looking at everything under /var/www which had all access to everyone, I don't know if this is the correct way to do it but it will do for now, once again thanks for your help


Pete Kane

All times are GMT -5. The time now is 10:33 PM.