LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-18-2004, 05:44 AM   #1
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Rep: Reputation: 15
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 dyndns.org to map my ip to mysite.homelinux.com, 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 "peters-site.homelinux.com", if I created a virtual host called "peters-newsite.com", how would I access it from the web ? would it become "peters-newsite.com.peters-site.homelinux.com" ?, as you can tell I need help, all help gratefully received

regards

Pete Kane
 
Old 08-18-2004, 06:54 AM   #2
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,509

Rep: Reputation: 46
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:
peters-site.homelinux.com/newsite

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

Last edited by bruno buys; 08-18-2004 at 06:55 AM.
 
Old 08-18-2004, 07:15 AM   #3
bruj3w
Member
 
Registered: Mar 2004
Location: england
Distribution: slackware
Posts: 164

Rep: Reputation: 30
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 peters-site.homelinux.com and peters-newsite.com, 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 peters-site.homelinux.com it will return the document from /var/www/site1 and if its from peters-newsite.com it will return the document from /var/www/site2.

edit your httpd.conf so it looks something like this

NameVirtualHost *

<VirtualHost *>
ServerName peters-site.homelinux.com
DocumentRoot /whatever/site1
</VirtualHost>

<VirtualHost *>
ServerName peters-newsite.com
DocumentRoot /whatever/site2
</VirtualHost>

easy as.

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

good luck anyway.
 
Old 08-18-2004, 07:22 AM   #4
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Original Poster
Rep: Reputation: 15
thanks for your reply, but how do I access these other sites from the Web ?, peters-site.homelinux.com is accessible because it's registered with dyndns.org, if I follow your example can I just enter peters-newsite.com ? where will the DNS be resolved?

confused

Pete Kane
 
Old 08-18-2004, 07:25 AM   #5
bruj3w
Member
 
Registered: Mar 2004
Location: england
Distribution: slackware
Posts: 164

Rep: Reputation: 30
you'll have to register peters-newsite.com with dyndns as well. just point it to the same ip that peters-site.homelinux.com is pointing too.

if your using the static dns thing you'll have to wait a while for it to work.
 
Old 08-18-2004, 07:34 AM   #6
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Original Poster
Rep: Reputation: 15
all is now clear, thank you very much for your time

regards

Pete Kane
 
Old 08-18-2004, 08:44 AM   #7
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Original Poster
Rep: Reputation: 15
Hello again, I've registered my new site with dyndns.org, 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 ?

regards

Pete Kane
 
Old 08-18-2004, 09:56 AM   #8
bruj3w
Member
 
Registered: Mar 2004
Location: england
Distribution: slackware
Posts: 164

Rep: Reputation: 30
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 :>
 
Old 08-18-2004, 10:01 AM   #9
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Original Poster
Rep: Reputation: 15
as requested

1) http://peter-kane.homelinux.com - this works

2) http://peterspatio.homelinux.com - this one returns index file not found ( error 403 )

regards

Pete Kane
 
Old 08-18-2004, 11:21 AM   #10
bruj3w
Member
 
Registered: Mar 2004
Location: england
Distribution: slackware
Posts: 164

Rep: Reputation: 30
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.
 
Old 08-19-2004, 04:36 AM   #11
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Original Poster
Rep: Reputation: 15
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

regards

Pete Kane

my DocumentRoot is a subdirectory of /var/html/
 
Old 08-19-2004, 05:38 AM   #12
pk_fox
Member
 
Registered: Oct 2003
Location: London, UK
Distribution: Fedora Core 2
Posts: 41

Original Poster
Rep: Reputation: 15
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

regards

Pete Kane
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Personal web server for testing web sites? Ariod Linux - Newbie 12 09-29-2005 04:30 PM
multiple web sites from one server robmainella Linux - Networking 1 08-22-2003 10:55 PM
web server from home? khutze Linux - Networking 11 01-06-2003 03:22 PM
Multiple FTP Sites on One server suomynona007 Linux - Networking 1 08-03-2002 01:27 AM
Running Two Web Sites On the same server Chijtska Linux - Networking 3 06-08-2002 11:13 PM


All times are GMT -5. The time now is 07:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration