problem with virtual named hosts - its always the default virtual site that's loaded

I have a server running Trixbox, so apache was already configured and
running. I wanted to add some virtual named hosts to this server, so
I set up A records for them pointing to the same IP. This server has
only 1 IP address.

Following the documents for Apache, I created a virtual host section
first that pointed at the Trixbox files. I then created the
additional virtual hosts. The problem is that while the new domain
names resolve to this server, it's ALWAYS the trixbox website pulled
up. I checked the log files as well, and the other sites are never
hit, the log files for them are at 0 bytes.

Here's the relevant section of my apache config file:

NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

Include /etc/trixbox/httpdconf/*

<VirtualHost *>
DocumentRoot /var/www/html
ServerName trixbox.domain.com
ErrorLog logs/trixbox.domain.com-error_log
CustomLog logs/trixbox.domain.com-access_log common
</VirtualHost>

<VirtualHost *>
DocumentRoot /www/docs/domain2.com
ServerName www.domain2.com
ErrorLog logs/domain2.com-error_log
CustomLog logs/domain2.com-access_log common
</VirtualHost>

<VirtualHost *>
DocumentRoot /www/docs/domain3.com
ServerName www.domain3.com
ErrorLog logs/domain3.com-error_log
CustomLog logs/domain3.com-access_log common
</VirtualHost>

Here's an excerpt from the error log file for trixbox.domain.com.
Note that the referrer shows up as www.domain2.com - this error has
nothing to do with my problem, I just point this out to indicate that
the request does seem to be originating with www.domain2.com but is
being picked up by the default virtual host.

[root [at] trixbox logs]# more trixbox.domain.com-error_log
[Tue Oct 23 23:21:12 2007] [error] [client 22.43.0.253] File does not
exist: /va
r/www/html/include/css/xoops.css, referer: http://www.domain2.com/
rrothberg [ Mi, 24 Oktober 2007 05:24 ] [ ID #1853363 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

I also meant to point out there is nothing relevant in /etc/trixbox/
httpdconf/* that's included. There is only one file and it just sets
up password protected directories.
rrothberg [ Mi, 24 Oktober 2007 05:27 ] [ ID #1853364 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

And one other thing I noticed that might be a clue

[root [at] trixbox /]# apachectl restart
[Tue Oct 23 23:50:48 2007] [warn] NameVirtualHost *:80 has no
VirtualHosts

I made sure that NameVirtualHost *:80 only appears once.
rrothberg [ Mi, 24 Oktober 2007 09:05 ] [ ID #1853370 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

Easy one.

You have this :

NameVirtualHost *:80 (note you have :80 in this)

So your virtual hosts must have the same

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName trixbox.domain.com
ErrorLog logs/trixbox.domain.com-error_log
CustomLog logs/trixbox.domain.com-access_log common
</VirtualHost>

change <VirtualHost *> to <VirtualHost *:80> and it will work.
Hans-Peter Sauer [ Mi, 24 Oktober 2007 09:41 ] [ ID #1853371 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

Thank you, I looked at these docs
http://httpd.apache.org/docs/2.0/vhosts/
over and over and I simply wasn't seeing my error for
some reason. I ultimately got it to work late last night
but by throwing in an IP address and port on each one.
I never saw my original error, thanks.

On Oct 24, 3:41 am, "Peter" <m... [at] privacy.net> wrote:
> Easy one.
>
> You have this :
>
> NameVirtualHost *:80 (note you have :80 in this)
>
> So your virtual hosts must have the same
>
> <VirtualHost *:80>
> DocumentRoot /var/www/html
> ServerName trixbox.domain.com
> ErrorLog logs/trixbox.domain.com-error_log
> CustomLog logs/trixbox.domain.com-access_log common
> </VirtualHost>
>
> change <VirtualHost *> to <VirtualHost *:80> and it will work.
rrothberg [ Mi, 24 Oktober 2007 12:37 ] [ ID #1853380 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

On Oct 23, 11:27 pm, robr <rrothb... [at] gmail.com> wrote:
> I also meant to point out there is nothing relevant in /etc/trixbox/
> httpdconf/* that's included. There is only one file and it just sets
> up password protected directories.

And one other thing I noticed that might be a clue

[root [at] trixbox /]# apachectl restart
[Tue Oct 23 23:50:48 2007] [warn] NameVirtualHost *:80 has no
VirtualHosts

I made sure that NameVirtualHost *:80 only appears once.
rrothberg [ Mi, 24 Oktober 2007 13:05 ] [ ID #1853381 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

On Oct 23, 11:27 pm, robr <rrothb... [at] gmail.com> wrote:
> I also meant to point out there is nothing relevant in /etc/trixbox/
> httpdconf/* that's included. There is only one file and it just sets
> up password protected directories.

And one other thing I noticed that might be a clue

[root [at] trixbox /]# apachectl restart
[Tue Oct 23 23:50:48 2007] [warn] NameVirtualHost *:80 has no
VirtualHosts

I made sure that NameVirtualHost *:80 only appears once.
rrothberg [ Mi, 24 Oktober 2007 18:24 ] [ ID #1853384 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

"robr" <rrothberg [at] gmail.com> schreef in bericht
news:1193198635.097553.23080 [at] e9g2000prf.googlegroups.com...
> On Oct 23, 11:27 pm, robr <rrothb... [at] gmail.com> wrote:
>> I also meant to point out there is nothing relevant in /etc/trixbox/
>> httpdconf/* that's included. There is only one file and it just sets
>> up password protected directories.
>
> And one other thing I noticed that might be a clue
>
> [root [at] trixbox /]# apachectl restart
> [Tue Oct 23 23:50:48 2007] [warn] NameVirtualHost *:80 has no
> VirtualHosts
I'm suffering the same warning and ignored it for now.
I guess it is a false warming occurring when 'NameVirtualHost *:80' and
'<VirutalHost *:80>' are not in the same _file_.

> I made sure that NameVirtualHost *:80 only appears once.
A <VirutalHost *:80> is (included) at least once too?

HansH
HansH [ Mi, 24 Oktober 2007 21:15 ] [ ID #1853386 ]

Re: problem with virtual named hosts - its always the default virtual site that's loaded

On Oct 23, 11:27 pm, robr <rrothb... [at] gmail.com> wrote:
> I also meant to point out there is nothing relevant in /etc/trixbox/
> httpdconf/* that's included. There is only one file and it just sets
> up password protected directories.

And one other thing I noticed that might be a clue

[root [at] trixbox /]# apachectl restart
[Tue Oct 23 23:50:48 2007] [warn] NameVirtualHost *:80 has no
VirtualHosts

I made sure that NameVirtualHost *:80 only appears once.
rrothberg [ Do, 25 Oktober 2007 02:58 ] [ ID #1854360 ]
Webserver » alt.apache.configuration » problem with virtual named hosts - its always the default virtual site that's loaded

Vorheriges Thema: Using mod ReWrite to redirect request with certain parameters.
Nächstes Thema: Apache 2.2.6 cannot load .so