Forum Moderators: phranque

Message Too Old, No Replies

virtual hosting

Numerous web sites on one IP?

         

ebola100

5:08 pm on Jun 6, 2005 (gmt 0)

10+ Year Member



I have a few friends with small text based web sites. I have a Dell PowerEdge SC420 that I bought to play around with Fedora Core. I currently have FC 3. It's fun and I would love to host the sites for them!

I had been hosting my own site with Apache for my students. Then I heard about virtual hosting so I bought other domains and sent them to my static IP.

I tried using the Server Setup with Fedora but I was unable to get the virtual hosts to associate with different folders.

Now nothing works. I tried to get back the old httpd.conf.bak but it doesn't work either. What should I do? Re-install apache? I'm a beginner to the extent that I know simple linux commands and was hosting a very simple site for history students. I got in trouble when I tried to have more than one website associated with the server.

All the examples I've seen use virtual hosting for stuff like "example.host.com" and "example2.host.com". Can virtual hosts be used with totally different sites like "Ilovehistory.com" and "Ilovelinux.com"? I wonder if those sites are real...

Thanks for any help!

David

jdMorgan

2:45 am on Jun 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David,

Welcome to WebmasterWorld!

See the Apache documentation, Name-based virtual hosts [httpd.apache.org] for some info to get you atarted.

And kind of late for this, but...
always make backups :)

Jim

ebola100

9:09 am on Jun 8, 2005 (gmt 0)

10+ Year Member



Well...I've been trying to follow the instructions verbatim but I can only get the main virtual host to load. None of the others load.

THis is the code:

NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com *.example.com
DocumentRoot "/var/www/html"
</VirtualHost>

NameVirtualHost 192.168.2.88:80
<VirtualHost 192.168.2.88:80>
ServerName www.quux_foo.com
ServerAlias quux_foo.com *.quux_foo.com
DocumentRoot /www/htmlccc
</VirtualHost>

quux_foo.com comes up exactly as example.com. Oh boy.

I think it is a binding problem but I don't know what that means really.

Thanks all.

[edited by: jdMorgan at 1:51 pm (utc) on June 8, 2005]
[edit reason] Examplified. [/edit]

Romeo

10:12 am on Jun 8, 2005 (gmt 0)

10+ Year Member



If name based virtual hosting is enabled, and a virtual host cannot be found, the server then uses the default definition instead, which is mostly the first defined vhost.

You need only one NameVirtualHost statement at the beginning. Delete the second one seen later on. Also, just make the both VirtualHost lines look the same: if the first one seems to work OK, then the second one should look like the same "<VirtualHost *:80>"

Regarads,
R.

ebola100

11:55 pm on Jun 9, 2005 (gmt 0)

10+ Year Member



THANK YOU ALL FOR THE HELP! Yes I have the virtual hosting working...

I'm wondering, at what point does virtual hosting within the httpd.conf file becomes cumbersome? After how many sites do you need the mod_rewrite (something which I know nothing about now).

But of course I love learning about this stuff.

mack

12:07 am on Jun 10, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You can add literaly hundreds of sites as virtual hosts. Mod_rewrite is not really related to the set up of virtual hosting, it is more related to file naming in each account, or re routing for url's.

Virtual hosting is pretty much the standard now within the hosting industry, the number of sites you can host will all depend on your hardware, and more importaintly the speed that you connect to the web.

Mack.