You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by si...@siberian.org on 2002/10/30 11:24:51 UTC

Perl Configured VirtualHost question

Typically my manually configured vhosts look like this :

NameVirtualHost 10.0.0.20:80

<VirtualHost 10.0.0.20:80>
      ServerName BladeBla.com
      DocRoot ....
      ...
      ...
</VirtualHost>
<VirtualHost 10.0.0.20:80>
...
</VirtualHost>

This works great for my statically configured hosts. How 
do you accomplish this same VHost scheme wheh configuring 
via perl? Each %VirtualHost key is a single server and I 
am so far unable to assign multiple values ( array ref? ) 
to a single key (the IP assigned in NameVirtualHost).

Any tips or pointers would be nice. I am trying to move a 
machine and in its new home the perl configured vhosts ( 
About 1100 of them ) are resolving to a the _default_ host 
since this particular system is using the older style name 
based hosts and not the newer (to me) NameVirtualHost 
directive syntax.

John-

Re: Perl Configured VirtualHost question

Posted by fliptop <fl...@peacecomputers.com>.
On Wed, 30 Oct 2002 at 02:24, siberian@siberian.org opined:

:Typically my manually configured vhosts look like this :
:
:NameVirtualHost 10.0.0.20:80
:
:<VirtualHost 10.0.0.20:80>
:      ServerName BladeBla.com
:      DocRoot ....
:      ...
:      ...
:</VirtualHost>
:<VirtualHost 10.0.0.20:80>
:...
:</VirtualHost>
:
:This works great for my statically configured hosts. How 
:do you accomplish this same VHost scheme wheh configuring 
:via perl? Each %VirtualHost key is a single server and I 
:am so far unable to assign multiple values ( array ref? ) 
:to a single key (the IP assigned in NameVirtualHost).

do you have the eagle book?  how to do this is documented on page 418.  
you are correct, use an array ref, with each value being a hash ref, one 
for each virtual host:

my @config = (
  { ServerName => 'one.fish.net',
    ServerAdmin => 'webmaster@one.fish.net',
    etc.... },
  { ServerName => 'red.fish.net',
    ServerAdmin => 'webmaster@red.fish.net',
    etc.... }
);

$VirtualHost{'192.168.2.5'} = \@config;