This is a discussion on VirtualHost odd behavior (inconsistent?) Apache-2.2 within the Apache Web Server forums, part of the Web Server and Related Forums category; I've set up apache-2.2 on SunOS 5.10, and have a fairly basic configuration that involves 2 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
<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 |
|
|||
|
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! |
|
|||
|
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 helpful. > > 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) |
|
|||
|
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 helpful. > > > 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. |
|
|||
|
<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 |