Good afternoon,

On 5/3/03 at 3:30 PM, Andrew Ho <[EMAIL PROTECTED]> wrote:

>I have an Apache with many VirtualHosts, and I want to setup proxying so
>that a lightweight frontend Apache with mod_rewrite/mod_proxy proxies
>Apache::Registry script requests back to a heavyweight backend Apache
>running on a localhost-only port.
>
>I want to simplify my configuration in two ways. I'd prefer not to
>maintain two sets of VirtualHost configuration data, and I'd like it if
>the block that proxies .pl files to the backend proxy not be replicated
>per VirtualHost.

I use mod_macro and IfDefine directives to simplify virtual host setups with
backend server.

First I do the bulk of the config in httpd.conf as usual (seperate conf files
for frontend and mod_perl) and then use Include directive to load files (one
for each virt host) from a directory.

Each included conf file is loaded by both frontend & mod_perl servers and
IfDefine controls which parts are used for each server.  This is a short
sample file (the Use directives are for mod_macro):

<IfDefine IS_FRONT_END>
    <VirtualHost 10.8.168.70:80>
        Use mSiteRoot gcs garrison.com.au
        
        Use mSiteLogs_frontend gcs
        Use mSiteUserGroup gcs

        Use mSiteRootDirOptions gcs
        Use mSiteCgiBinDirOptions gcs
    
        Use mSetupRewrite
        Use mSiteRewriteRules   

    </VirtualHost>
</IfDefine>

<IfDefine IS_PERL>
    <VirtualHost 10.8.168.70:8520>
        Use mSiteRoot gcs garrison.com.au

        Use mSiteLogs_modperl gcs
        Use mSiteUserGroup gcs
    
        Use mSiteRootDirOptions gcs
        Use mSitePerlBinDirOptions gcs

    </VirtualHost>
</IfDefine>


This setup doesn't put all the rewrite config in the main conf file, but it
does centralize it all to make maintenance much easier. And there is only one
conf file for each virt host.


Charlie
-- 
   Charlie Garrison    [EMAIL PROTECTED]
   PO Box 141, Windsor, NSW 2756, Australia 

Reply via email to