httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Eden <li...@janeden.org>
Subject Re: [users@httpd] Virtual Host warning
Date Thu, 24 Mar 2005 21:56:07 GMT
Joshua Slive wrote on 24.03.2005:

>>I actually do have two complete VirtualHosts (with individual
>>DocumentRoots), but most of my VirtualHosts are indeed incomplete.
>>But shouldn't Apache also complain if I have NameVirtualHost and
>>VirtualHost configured for all IPs/ports if the incomplete
>>VirtualHosts are the problem?
>
>I don't understand this paragraph.  But  another thing to look for
>with regard to the error messages: You know that you should be using
>only a single NameVirtualHost directive for each IP, and not one per
><VirtualHost>, right?
>
Sorry if I haven't been clear so far. This is where I stand. I get the warning using this

NameVirtualHost 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
    ServerName testserver
</VirtualHost>

or this

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
    ServerName testserver
</VirtualHost>

I get no warnings doing this

NameVirtualHost *
<VirtualHost *>
    ServerName testserver
</VirtualHost>

If I run httpd -S I get

[Thu Mar 24 22:51:35 2005] [warn] NameVirtualHost 127.0.0.1:8080 has no VirtualHosts
VirtualHost configuration:
127.0.0.1:8080         is a NameVirtualHost
         default server mysqladmin (/usr/local/apache2/conf/httpd.conf:313)
         port 8080 namevhost mysqladmin (/usr/local/apache2/conf/httpd.conf:313)
         port 8080 namevhost mysqladmin (/usr/local/apache2/conf/httpd.conf:313)
         port 8080 namevhost datenbanken (/usr/local/apache2/conf/httpd.conf:318)
         port 8080 namevhost datenbanken (/usr/local/apache2/conf/httpd.conf:318)
         port 8080 namevhost briefmaschine (/usr/local/apache2/conf/httpd.conf:328)
         port 8080 namevhost briefmaschine (/usr/local/apache2/conf/httpd.conf:328)
Syntax OK

><VirtualHost> sections have no effect at all on what hostnames apache
>listens to.  Apache will automatically take requests for all
>hostnames.  So if all the names are treated the same, you don't need
>a <VirtualHost> section at all.  If you have some "normal" virtual
>hosts that are not subject to the RewriteRules, then you can have a
><VirtualHost> section for each of those, and then a separate
><VirtualHost> section for all the other hosts, where you list a
>single ServerName and all the other names are listed under
>ServerAlias.

Yes, my description was misleading. I though that without the different ServerName directives
inside my VirtualHosts, CGI.pm's server_name() method could not distinguish between the various
websites the Apache process should act as.

And here is the really embarrassing part: I never thought of turning off UseCanonicalHostname,
so the requested hostname gets used automatically.

Anyway, I still need the two (three) VirtualHosts returned by the above test, and "Syntax
OK" seems to contradict the warning. This is the VirtualHost section:

NameVirtualHost 127.0.0.1:8080

<VirtualHost 127.0.0.1:8080>
    ServerName mysqladmin
    DocumentRoot /Users/jan/Sites/mysqladmin
</VirtualHost>

<VirtualHost 127.0.0.1:8080>
    ServerName datenbanken
    DocumentRoot /Users/jan/Sites/datenbanken
    <Directory />
        Options FollowSymLinks ExecCGI
        AllowOverride None
    </Directory>
    DirectoryIndex index.pl
</VirtualHost>

<VirtualHost 127.0.0.1:8080>
    ServerName briefmaschine
    DocumentRoot /Users/jan/Sites/briefmaschine
    <Directory />
        Options FollowSymLinks ExecCGI
        AllowOverride None
    </Directory>
    DirectoryIndex brief.pl 
</VirtualHost>

Thanks for your helpful hints,

Jan
-- 
How many Microsoft engineers does it take to screw in a lightbulb? None. They just redefine
"dark" as the new standard.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message