PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > VirtualHost odd behavior (inconsistent?) Apache-2.2
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

VirtualHost odd behavior (inconsistent?) Apache-2.2

Réponse
 
LinkBack Outils de la discussion
Vieux 16/02/2007, 17h02   #1
forrie@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut VirtualHost odd behavior (inconsistent?) Apache-2.2

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.

What I'm seeing is odd, as it doesn't seem to coincide with the
documentation - therefore, I can only assume this is "user
error" (grin).

_default_:80

Should catch anything coming to the machine that is NOT DEFINED, such
as just coming to port 80 via IP address.

<VirtualHost host-name1.domain.com>

<VirtualHost host-name2.domain.com>

are basic entries, nothing special.

NameVirtualHost xx.xx.xx.xx

and have tried

NameVirtualHost *:80

I'm using the latter at this point.

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.

If I take that out, it will work.

However, if I put in:

Listen xx.xx.xx.xx:80

That breaks it, which makes no sense to me. So I just leave it as:

Listen 80

which works.

I've tried mixing around using IP virtual hosts and name-based...
still get odd results.

I've followed the documentation on apache.org.

To ensure that the _default_ definition appears "first", I placed that
in the main httpd.conf file *before* the Include for the vhosts. So
that isn't the issue.

Anyone see this before? I'm stumped. I know what I have now
(without _default_) is working, but I'm still suspicious and it's not
100% of what I need, so I want to figure it out.

I won't spam the group with my *.conf details here - will send under
separate cover if someone wants to see it. I've also considered
whether this behavior might be due to a Module (or lack thereof), and
I cannot tell yet.

Thanks.

  Réponse avec citation
Vieux 16/02/2007, 17h43   #2
HansH
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

<forrie@gmail.com> schreef in bericht
news:1171645336.849562.167470@s48g2000cws.googlegr oups.com...
> What I'm seeing is odd, as it doesn't seem to coincide with the
> documentation - therefore, I can only assume this is "user
> error" (grin).
>
> _default_:80
>
> Should catch anything coming to the machine that is NOT DEFINED, such
> as just coming to port 80 via IP address.

If used like <_default_:80>
and untill you mix name-based and IP-based ...
.... where name-based means using ServerName directive
.... not the name in DNS

> <VirtualHost host-name1.domain.com>
> <VirtualHost host-name2.domain.com>

:
> I end up at host-name2.

I assume the IP of host-name2.domain.com matches your machine's IP.

Anyway, try what happens when you change both your
<VirtualHost ...domain.com>
into
<VirtualHost *:80>
Servername ...domain.com

HansH


  Réponse avec citation
Vieux 16/02/2007, 17h57   #3
Davide Bianchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

On 2007-02-16, forrie@gmail.com <forrie@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?
  Réponse avec citation
Vieux 16/02/2007, 18h07   #4
forrie@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

On Feb 16, 12:43 pm, "HansH" <h...@invalid.invalid> wrote:
> <for...@gmail.com> schreef in berichtnews:1171645336.849562.167470@s48g2000cws.g ooglegroups.com...> What I'm seeing is odd, as it doesn't seem to coincide with the
> > documentation - therefore, I can only assume this is "user
> > error" (grin).

>
> > _default_:80

>
> > Should catch anything coming to the machine that is NOT DEFINED, such
> > as just coming to port 80 via IP address.

>
> If used like <_default_:80>
> and untill you mix name-based and IP-based ...
> ... where name-based means using ServerName directive
> ... not the name in DNS
>
> > <VirtualHost host-name1.domain.com>
> > <VirtualHost host-name2.domain.com>

> :
> > I end up at host-name2.

>
> I assume the IP of host-name2.domain.com matches your machine's IP.
>
> Anyway, try what happens when you change both your
> <VirtualHost ...domain.com>
> into
> <VirtualHost *:80>
> Servername ...domain.com
>
> HansH


The IP is the same, yes. I forgot to mention that I tried both

<VirtualHost *:80>

and

<VirtualHost host-name1.domain.com>

combinations and, with <_default_:80> got mixed results that seemed
inconsistent with what should happen.


Thanks!

  Réponse avec citation
Vieux 16/02/2007, 18h53   #5
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

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)

  Réponse avec citation
Vieux 16/02/2007, 19h46   #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
Vieux 16/02/2007, 20h34   #7
HansH
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

<forrie@gmail.com> schreef in bericht
news:1171649269.468792.10430@p10g2000cwp.googlegro ups.com...
> On Feb 16, 12:43 pm, "HansH" <h...@invalid.invalid> wrote:
>> <for...@gmail.com> schreef in
>> berichtnews:1171645336.849562.167470@s48g2000cws.g ooglegroups.com...>
>> > _default_:80
>> > Should catch anything coming to the machine that is NOT DEFINED, such
>> > as just coming to port 80 via IP address.

>> If used like <_default_:80>
>> and untill you mix name-based and IP-based ...
>> ... where name-based means using ServerName directive
>> ... not the name in DNS
>>
>> > <VirtualHost host-name1.domain.com>
>> > <VirtualHost host-name2.domain.com>

>> :
>> > I end up at host-name2.

>>
>> I assume the IP of host-name2.domain.com matches your machine's IP.
>>
>> Anyway, try what happens when you change both your
>> <VirtualHost ...domain.com>
>> into
>> <VirtualHost *:80>
>> Servername ...domain.com
>>

> The IP is the same, yes. I forgot to mention that I tried both
>
> <VirtualHost *:80>

With or without a ServerName ?
.... WITHOUT it'll take preferance over _default_

>
> and
>
> <VirtualHost host-name1.domain.com>
>
> combinations and, with <_default_:80> got mixed results ...

Mixed settings may indeed give mixed results :-(


HansH


  Réponse avec citation
Vieux 17/02/2007, 07h37   #8
Davide Bianchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost odd behavior (inconsistent?) Apache-2.2

On 2007-02-16, forrie@gmail.com <forrie@gmail.com> wrote:
> Okay, I'll see if I can test that.


See if you can also improve your quoting... is really hard to figure
out to what or who you're responding...

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


....hu?

> Meaning, the host is named "machine1"


the hostname doesn't matter if you're using VHosts. And if you aren't
then it matter a little.

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


he... unless you can craft a complete http request is quite hard. The
simplest way is to use a browser, even lynx will do.

><VirtualHost *:80>
>
> with
>
><VirtualHost machine.name.com:80>


The *:80 or machine.name.com:80 is the same thing you have in the
NameVirtualHost directive, this is to allow multiple NameVirtualHost
with different port/ip number to be served by the same machine without
confusion.

Davide

--
Slight disorientation after prolonged system uptime is normal for new Linux
users. Please do not adjust your browser.
-- From a Slashdot.org post
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h15.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,21547 seconds with 16 queries