"Randal L. Schwartz" wrote:
> 
> >>>>> "Mike" == Mike Blazer <[EMAIL PROTECTED]> writes:
> 
> Mike> Yeah, thanks. But the whole that site has nothing to do without the
> Mike> database :) It almost has no static content.
> Mike> But seems like you are both right. Template would be really safer. While
> Mike> this also breaks the nice concept of starting each server with apachectl
> Mike> -D <name> and having all confugurables (perl vars, hashes) together in
> Mike> the same file.
> 
> Solution:
> 
> generate
> 
>         httpd.conf.pages
>         httpd.conf.proxy
> 
> using Template Toolkit.  Easy'nuff.  Lots of common stuff, plus unique
> stuff.  You can use "tpage" and then there's not even any programming:
> 
>         httpd.conf.pages: httpd.conf.tmpl
>                 tpage --define server=pages < $< > $@
>         httpd.conf.proxy: httpd.conf.tmpl
>                 tpage --define server=proxy < $< > $@
> 
> then check [% IF server = 'pages'; ... ; END %] in your templates.
> 
> Make httpd.conf be simply:
> 
>         <ifdefine pages>
>         Include httpd.conf.pages
>         </ifdefine>
>         <ifdefine proxy>
>         Include httpd.conf.proxy
>         </ifdefine>
>         <ifdefine !pages>
>         <ifdefine !proxy>
>         Include httpd.conf.other
>         </ifdefine>
>         </ifdefine>
> 
> Done. :)

Well, thanks, this is much what I'm doing

<IfDefine be-image>
   PidFile logs/httpd_image.pid
   ScoreBoardFile logs/apache_runtime_status.image

   <Perl>
        $Counter::INI::httpd_name = "image";
   </Perl>
</IfDefine>
<IfDefine be-pages>
   PidFile logs/httpd_pages.pid
   ScoreBoardFile logs/apache_runtime_status.pages

   <Perl>
        $Counter::INI::httpd_name = "pages";
   </Perl>
</IfDefine>
<Perl>
   $Counter::INI::ssl = 0;
</Perl>
<IfDefine SSL>
   <Perl>
   $Counter::INI::ssl = 1;
   </Perl>
</IfDefine>

etc.

but then the virtual hosts vary so much that it's no use to use a
template - they are very different. Plus, my conf work also on my home
Win32 machine, so all paths are also calculated in <Perl> section. Plus
2 httpd+mod_perl servers (light and heavy) use different subsets of
modules (loaded in different startup.pl files). So, it'd anyway take to
generate a large parts of conf-code and send to template. I'm just
sending it directly to Apache->httpd_conf :)

But as for the proxy (without mod_perl) - yes, I'm already typing a
template, unfortunatelly it seems like the only way...

Anyway, for some future, may be it worth to use some efforts to be able
to use <Perl> sections even for the servers that don't need mod_perl
processing - by loading and unloading mod_perl or by loading it into
some separate thread and killing it after the server startup. It'd be
great to have this feature to configure Apache.

Thanks, I'll look into the templating thing. I'm a little stuck in my
mind in <Perl> sections, because it was already done this way in my
previous 1-server conf. Probably it's better to generate static
conf-files with small <Perl> parts with PerlSetVar's only.

I'll look into that, thanks.
-- 
==================================
Mike Blazer
[EMAIL PROTECTED]
==================================

Reply via email to