Click to See Complete Forum and Search --> : Virtualhost problem...


anton
06-19-2001, 03:04 PM
Hello ,

I have following in my httpd.conf :


<VirtualHost _default_:80>
DocumentRoot /www/mail.ruscore.net
ServerName mail.ruscore.net
</VirtualHost>

<VirtualHost _default_:80>
DocumentRoot /www/ruscore.net
ServerName ftp.ruscore.net
</VirtualHost>


but when I go to http://ftp.ruscore.net I still end up in /www/mail.ruscore.net

why is that ?

thanks : )

Craig McPherson
06-19-2001, 08:29 PM
Can you really use _default_ in a Virtual Host directive? I've never seen that before, but it'd be cool if it worked. Can you point me at the documentation where you saw that?

Did you do a NameVirtualHost directive before your individual virtual host directives? Did you try it by using your IP address instead of the _default_ thing, which I've never seen before?

anton
06-19-2001, 10:37 PM
Craig : _default_ put there a webmin ...

first I was trying to do it by hands, with help of apache.org documentation , and I had IPs there, and it did the same thing : (


and , yes, I did NameVirtualHost *:80 before all that ...

thanks...

Craig McPherson
06-19-2001, 11:33 PM
Originally posted by anton:
<STRONG>and , yes, I did NameVirtualHost *:80 before all that ...</STRONG>

You can't do that, you have to use the EXACT IP address.

anton
06-20-2001, 01:54 AM
but they did it here ...
http://httpd.apache.org/docs/vhosts/examples.html

first example ...

Craig McPherson
06-20-2001, 03:55 AM
Hmm, okay, I didn't know that'd work. But it'll make my life a lot easier. Cool.

One thing I do know is that the name you specify in the NameVirtualHost directive has to be exactly the same as the name you use is the individual VirtualHost directives.

For example, if you use "*" in the NameVirtualHost, you have to use "*" in all the individual virtual hosts. If you use "*:80", you have to use "*:80". Otherwise, it won't pick them up right.

Something like this:

NameVirtualHost *

&lt;VirtualHost *&gt;
DocumentRoot /www/mail.ruscore.net
ServerName mail.ruscore.net
&lt;/VirtualHost&gt;

&lt;VirtualHost *&gt;
DocumentRoot /www/ruscore.net
ServerName ftp.ruscore.net
&lt;/VirtualHost&gt;

Unless you're going to be doing SSL, I wouldn't even bother doing the port.

Let me know if it works...

Oh yeah -- and make sure the web browser you're trying this with uses HTTP1.1. Name-based Virtual Hosts only work with HTTP1.1, or with hacked-up HTTP1.0 browsers. This probably isn't an issue unless you're using Netscape 2 or something, but I thought I'd better mention it.