LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Multiple Web sites on home server (https://www.linuxquestions.org/questions/linux-networking-3/multiple-web-sites-on-home-server-219161/)

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 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

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:
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.

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 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.

pk_fox 08-18-2004 07:22 AM

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

bruj3w 08-18-2004 07:25 AM

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.

pk_fox 08-18-2004 07:34 AM

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

regards

Pete Kane

pk_fox 08-18-2004 08:44 AM

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

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) http://peter-kane.homelinux.com - this works

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

regards

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

regards

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

regards

Pete Kane


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