Web Servers on Unix and Linux - Problems with NameVirtualHost directive

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > November 2005 > Problems with NameVirtualHost directive





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Problems with NameVirtualHost directive
news@celticbear.com

2005-11-17, 6:10 pm

In migrating our server to a new one with Apache 2.0.52.
And I'm getting various errors from my "/etc/rc.d/ini.d/httpd
configtest" depending on what I try from the O'Reilly "Apache
Definitive Guide" and similar suggestions found on the newsgroup for
similar problems.

Here's the top of my virtualdir that I have included at the end of my
httpd.conf:

NameVirtualHost (our IP)

<VirtualHost (our IP):80>
DocumentRoot /var/www/html/home/pa
ServerName (our domain).com
ServerAlias www.(our domain).com
TransferLog /var/www/html/home/logs/access_log
ErrorLog /var/www/html/home/logs/error_log
</VirtualHost>

<IfDefine HAVE_SSL>
<VirtualHost (our IP):443>
DocumentRoot /var/www/html/home/pa
ServerName (our domain).com
ServerAlias www.(our domain).com
TransferLog /var/www/html/home/pa/logs/access_log
ErrorLog /var/www/html/home/pa/logs/error_log
SSLEngine on
SSLCertificateFile /etc/httpd/conf.d/ssl.crt/(our domain).com.crt
SSLCertificateKeyFile /etc/httpd/conf.d/ssl.key/(our domain).com.key
</VirtualHost>
</IfDefine>

<VirtualHost (our IP):80>
DocumentRoot /var/www/html/home/pa2
ServerName (our domain 2).com
ServerAlias www.(our domain 2).com
</VirtualHost>

(and then about 50 more hosted domains below that one.)


Now, if I configtest just like it is above, I get 50:

[Thu Nov 17 17:23:54 2005] [error] VirtualHost (our IP):80 -- mixing *
ports and non-* ports with a NameVirtualHost address is not supported,
proceeding with undefined results

If I take out the NameVirtualHost line, I get 50:

[Thu Nov 17 16:37:15 2005] [warn] VirtualHost (our IP):80 overlaps with
VirtualHost (our IP):80, the first has precedence, perhaps you need a
NameVirtualHost directive

If I leave in the line, but change all the IP addresses to their names
like this:

<VirtualHost www.(our domain 2).com>
DocumentRoot /var/www/html/home/pa2
ServerName (our domain 2).com
ServerAlias www.(our domain 2).com
</VirtualHost>

I get 50:

[Thu Nov 17 17:33:08 2005] [error] (EAI 2)Name or service not known:
Cannot resolve host name www.(our domain 2).com --- ignoring!

followed by 50:

[Thu Nov 17 17:33:12 2005] [warn] VirtualHost www.(our domain 2).com:0
overlaps with VirtualHost www.(our domain 3).com:0, the first has
precedence, perhaps you need a NameVirtualHost directive

What combination of IP, port, names do I need to use?
I'm at the end of combinations I can think of.

Thanks for any help!
Liam

Tim

2005-11-17, 8:53 pm

On Thu, 17 Nov 2005 15:36:42 -0800, news sent:

> In migrating our server to a new one with Apache 2.0.52. And I'm getting
> various errors from my "/etc/rc.d/ini.d/httpd configtest" depending on
> what I try from the O'Reilly "Apache Definitive Guide" and similar
> suggestions found on the newsgroup for similar problems.
>
> Here's the top of my virtualdir that I have included at the end of my
> httpd.conf:
>
> NameVirtualHost (our IP)


Try changing all the "(our IP)" bits from your IP address to just: *

Condensing my config file, I have this sort of thing:

NameVirtualHost *:80

<VirtualHost _default_:80>
# Default website to serve, regardless of hostname
</VirtualHost>

<VirtualHost _default_:443>
# Default, and only, HTTPS website to serve
</VirtualHost>

<VirtualHost *:80>
# Another website
</VirtualHost>

<VirtualHost *:80>
# Yet another website
</VirtualHost>

<VirtualHost *:80>
# Yet another website
</VirtualHost>


> [Thu Nov 17 17:23:54 2005] [error] VirtualHost (our IP):80 -- mixing *
> ports and non-* ports with a NameVirtualHost address is not supported,
> proceeding with undefined results


Which is to do with the SSL site (it's not on port 80).

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please destroy some files yourself.

news@celticbear.com

2005-11-18, 5:51 pm


Tim wrote:
> On Thu, 17 Nov 2005 15:36:42 -0800, news sent:
>
>
> Try changing all the "(our IP)" bits from your IP address to just: *
>
> Condensing my config file, I have this sort of thing:
>
> NameVirtualHost *:80
>
> <VirtualHost _default_:80>
> # Default website to serve, regardless of hostname
> </VirtualHost>
>
> <VirtualHost _default_:443>
> # Default, and only, HTTPS website to serve
> </VirtualHost>
>
> <VirtualHost *:80>
> # Another website
> </VirtualHost>
>
> <VirtualHost *:80>
> # Yet another website
> </VirtualHost>
>
> <VirtualHost *:80>
> # Yet another website
> </VirtualHost>
>
>
>
> Which is to do with the SSL site (it's not on port 80).
>


Interesting.
Now I get 50:

[Fri Nov 18 10:27:26 2005] [warn] _default_ VirtualHost overlap on port
80, the first has precedence

But, the asterik gives me another combination component to try
different things with.
Thanks for the reply and suggestion!
-Liam

Tim

2005-11-19, 2:47 am

Liam:

> depending on what I try from the O'Reilly "Apache Definitive Guide"


Have you tried following Apache's own documentation, instead?

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please destroy some files yourself.

Tim

2005-11-19, 2:47 am

On Fri, 18 Nov 2005 08:28:42 -0800, news@celticbear.com sent:

> Interesting.
> Now I get 50:
>
> [Fri Nov 18 10:27:26 2005] [warn] _default_ VirtualHost overlap on port
> 80, the first has precedence
>
> But, the asterik gives me another combination component to try
> different things with.


Sounds like the virtual hosts conflicting with the default set in the main
configuration. I seem to recall putting <VirtualHost _default_:80> and
</VirtualHost> around the initial website configuration in the main
configuration (the /var/www/html/ part) to fix that in one incarnation of
Apache, a while ago.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please destroy some files yourself.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com