Afficher un message
Vieux 16/02/2007, 20h46   #6
forrie@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

On Feb 16, 1:53 pm, "shimmyshack" <matt.fa...@gmail.com> wrote:
> On Feb 16, 5:57 pm, Davide Bianchi <davideyeahs...@onlyforfun.net>
> wrote:
>
>
>
> > On 2007-02-16, for...@gmail.com <for...@gmail.com> wrote:

>
> > > I've set up apache-2.2 on SunOS 5.10, and have a fairly basic
> > > configuration that involves 2 NameVirutalHosts, and a _default_
> > > definition.

>
> > So it's basically 3 VirtualHosts, one of which should be the default.

>
> > > _default_:80

>
> > IIRC is supposed to be

>
> > <VirtualHost _default_ *:80>

>
> > Depending on how you defined the NameVirtualHost directive.

>
> > > I'm using the latter at this point.

>
> > Then your two VirtualHost should be defined as
> > <VirtualHost *:80>
> > ServerName domainN....

>
> > And the default should be

>
> > <VirtualHost _default_ *:80>

>
> > > Now: when I connect to this system via IP address, instead of going
> > > to the _default_ location (DocumentRoot goes to the same path as host-
> > > name1), I end up at host-name2.

>
> > It's sound like a real mess-up of the configuration. What does
> > apachectl configtest return?

>
> > > I won't spam the group with my *.conf details here - will send under
> > > separate cover if someone wants to see it.

>
> > Yes, it would be ful.

>
> > Davide

>
> > --
> > In a world without fences who needs Gates?
> > Now: when I connect to this system via IP address, instead of going
> > to the _default_ location (DocumentRoot goes to the same path as host-
> > name1), I end up at host-name2.

>
> of oucrse it depends what this means, using a browser the IP will be
> sent as the host, whereas not sending a host header at all should
> result in _default_ being served,
>
> I have a 3 virtual hosts (as well as all the others)
> _default_
> internal IP
> external IP
>
> they are all different doc roots, and the only time _default_comes
> into play is if theres no host header present. (using DCMVH on apache
> 2.2.4)


Okay, I'll see if I can test that.

However, if I got directly to the host with the IP address, shouldn't
it go to the VirtualHost that the ServerName is the hostname for?
Meaning, the host is named "machine1" and I go to it via
xxx.xxx.xxx.xxx, it ends up in the DocRoot of "machine2" instead,
which is a CNAME record.

How can I reliably test this without the host header... perhaps on the
command line.

On my other FreeBSD system, the above works correctly - if someone
goes to my machine via IP, it goes to the _default_ docroot, not to
anything else. Maybe I'll need to backtrack and replace the:

<VirtualHost *:80>

with

<VirtualHost machine.name.com:80>

and muck with the DocumentRoot to see what happens.



  Réponse avec citation
 
Page generated in 0,07407 seconds with 9 queries