[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Apache Virtual Server



On Thu, 2009-04-30 at 08:30 -0400, Mike Burger wrote:
> Having read the entire thread, so far, I don't believe that anyone
> else has actually identified the issue.
>
> The issue is the use of:
>
> <VirtualHost *:80>
>
> You've got a wildcard in every "VirtualHost" declaration.  As a
> result, you're going to match on the very first VirtualHost, and never
> get past it.

That's the normal way it works, that's why no-one's said what you have.
The ServerName and ServerAlias directives inside each virtual host is
where the matching takes place.  ServerName being the canonical name it
should use, and ServerAlias listing any alternative aliases.

If you were going to put anything in there, it would be an IP address.
And your server would have to have just a single address, you'd have
problems if it had two addresses, and you tested on both (e.g. internal
and external addresses).

The usual problem with virtual hosts, is that the first thing that
matches, wins.  If something does manage to match, and it's ahead of
your virtual host definitions, that's the problem.

I think there's two threads on this subject running at the moment, and
I'm getting confused as to which has been resolved.

Looking back at a posting by the original poster, they had this in it:

[root confianza conf]# cat /etc/hosts
127.0.0.1        localhost.localdomain localhost
127.0.0.1        confianza
127.0.0.1        confianzaZend
::1        localhost6.localdomain6 localhost6
192.168.0.2    amor                    amor.
192.168.0.3    esperanza
192.168.0.4    confianza
192.168.0.5     BRNEE2FCB
192.168.0.6    glitter
192.168.0.8    fe

They've got the same hostname associated with two different IP
addresses, that might cause its own problems.  I'd always leave the
local loopback addresses alone ("127.0.0.1" & "::1"), only ever adding
hostnames to other IPs.  But I don't think that's the cause of this
problem.

They had a sample with PHP testing the hostname, but I suspect that
might behave differently than what's differentiating hosts apart (you
can have one server replying to several host names, and it'll use the
*requested* hostname (by the client) in the query to match, rather than
getting the name from the server.

-- 
[tim localhost ~]$ uname -r
2.6.27.21-78.2.41.fc9.i686

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]