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/
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.
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.
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.
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.
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.
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.
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
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.