You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Krist van Besien <kr...@gmail.com> on 2006/09/24 21:06:08 UTC

Virtual Hosts in "Perl" sections.

Hello,

The folllowing piece:

      1 <Perl>
      2 $VirtualHost{"0.0.0.0"} = {
      3      DocumentRoot => "/home/foo/webservers/wiki.foo.net/htdocs",
      4      ServerName => "wiki.foo.net",
      5   };
      6
      7
      8 </Perl>

Creates a virtual host that is equivalent to the following code:

<VirtualHost *.*>
    ServerName wiki.foo.net
    DocumentRoot /home/foo/webservers/wiki.foo.net/htdocs
</VirtualHost>

How do I, however, add a second virtualhost. Adding another
$VirtualHost{"0.0.0.0"}=...
only overwrites the first definition.

Krist

-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland

Re: Virtual Hosts in "Perl" sections.

Posted by Fred Moyer <fr...@redhotpenguin.com>.
Krist van Besien wrote:
> Hello,
> 
> The folllowing piece:
> 
>      1 <Perl>
>      2 $VirtualHost{"0.0.0.0"} = {
>      3      DocumentRoot => "/home/foo/webservers/wiki.foo.net/htdocs",
>      4      ServerName => "wiki.foo.net",
>      5   };
>      6
>      7
>      8 </Perl>
> 
> Creates a virtual host that is equivalent to the following code:
> 
> <VirtualHost *.*>
>    ServerName wiki.foo.net
>    DocumentRoot /home/foo/webservers/wiki.foo.net/htdocs
> </VirtualHost>
> 
> How do I, however, add a second virtualhost. Adding another
> $VirtualHost{"0.0.0.0"}=...
> only overwrites the first definition.

By adding another host that way you are overwriting the first hash key. 
  I'm not a PerlSections expert, but you might be able to say:

push @{$VirtualHost{"0.0.0.0"}}, { # virtual host n details };