This section describes the configuration of the backend server.
The backend server listens on the loopback (localhost) interface:
BindAddress 127.0.0.1
In this context, the following directive does not specify a listening port:
Port 80
Rather, it indicates which port the server should advertise when issuing a redirect.
The following global mod_perl settings are shared by all virtual hosts:
##### mod_perl settings PerlRequire /home/httpd/perl/startup.pl PerlFixupHandler Apache::SizeLimit PerlPostReadRequestHandler Book::ProxyRemoteAddr PerlSetupEnv Off
As explained earlier, we use the Book::ProxyRemoteAddr handler to get the real remote IP addresses from the proxy.
We can then proceed to configure the virtual hosts themselves:
##### www.example.com Listen 8001 <VirtualHost 127.0.0.1:8001>
The Listen directive specifies the port to listen on. A connection to that port will be matched by this <VirtualHost> container.
The remaining configuration is straightforward:
ServerName www.example.com
ServerAdmin webmaster@example.com
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
<Location /perl-status>
SetHandler perl-script
PerlHandler Apache::Status
</Location>
</VirtualHost>
We configure the second virtual host in a similar way:
##### www.example.org
Listen 8002
<VirtualHost 127.0.0.1:8002>
ServerName www.example.org
ServerAdmin webmaster@example.org
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
</VirtualHost>
You may need to specify the DocumentRootsetting in each virtual host if there is any need for it.
 
Continue to: