Practical mod_perl / HTML Book /



previous page: 12.10.2. Dual-Server Virtual Host Configuration
  
page up: HTML Version of the book
  
next page: 12.10.4. Frontend Server Configuration

12.10.3. Virtual Hosts and Main Server Interaction


When using virtual hosts, any configuration directive outside of a <VirtualHost> container is applied to a virtual host called the main server, which plays a special role. First, it acts as the default host when you're using name-based virtual hosts and a request can't be mapped to any of the configured virtual hosts (for example, if no Host: header is provided). Secondly, many directives specified for the main server are merged with directives provided in <VirtualHost> containers. In other words, virtual hosts inherit properties from the main server. This allows us to specify default behaviors that will apply to all virtual hosts, while still allowing us to override these behaviors for specific virtual hosts.

In the following example, we use the PerlSetupEnv directive to turn off environment population for all virtual hosts, except for the www.example.com virtual host, which needs it for its legacy CGI scripts running under Apache::Registry:

PerlSetupEnv Off

Listen 8001
<VirtualHost 127.0.0.1:8001>
    ServerName www.example.com
    PerlSetupEnv On
</VirtualHost>

 

Continue to:

  • prev: 12.10.2. Dual-Server Virtual Host Configuration
  • Table of Contents
  • next: 12.10.4. Frontend Server Configuration







TOP
previous page: 12.10.2. Dual-Server Virtual Host Configuration
  
page up: HTML Version of the book
  
next page: 12.10.4. Frontend Server Configuration


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com