You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by James G Smith <JG...@TAMU.Edu> on 2002/06/03 17:57:26 UTC

Re: Generating dynamic VirtualHost and Location directives and reloading Apache configuration

Mathieu Jondet <ma...@jondet.org> wrote:
>Hi all,
>    I'm actually working on a application for generating dynamic virtual
>
>host and locations in these virtual host from a web interface.
>    The purpose of this application is to give a non-administrator the
>possibility of adding on the fly virtualhost to a webserver without
>modifying httpd.conf and to add locations to a specific virtualhost.
>
>    So far I've manage to do the part of generating the httpd.conf file
>through <Perl> sections which takes all the necessary data from a MySQL
>server. The tricky part is to update the server configuration without
>having to restart the server.
>    I've looked on the web and in the archives of the mailing list and
>found things about
>using the PerlInitHandler and sending Apache a SIGUSR1 signal.
>    I don't know how to do this as I'm quite new to the mod_perl
>programming. I would
>also want to know if it won't be too slow to check the modifications
>times of the
>config in the database at each client request.
>
>Do you have any other idea of doing this ?
>What will be the more efficient way to update my configuration against a
>database ?
>
>Thanks for answers and ideas,

I'm working on the design of something similar -- right now I'm doing
a config file that will (hopefully) allow configuration of Apache 2
or Apache 1.3 (Apache 2 as front SSL proxy and Apache 1.3 as backend
application server) depending on which role it is playing.  I still
have some studying and playing to do to see if this is possible.  If
Apache 1.3 is in both roles, I know it is possible.

<side note>
  Apache 2 with mod_perl should not be an expensive proxy (compared
  to Apache 1.3/mod_perl or even Apache 2 without mod_perl).  It can
  be configured to have no more than one Perl interpreter, regardless
  of the number of threads.  It might be possible to configure it
  with zero perl interpreters and only use Perl during the
  configuration.  Of course, Apache 2/mod_perl isn't quite
  production-quality, yet.
</side note>

Instead of doing expensive checks, the page that is used to manage
the configuration information in the database can detect changes and
either send the appropriate signals or provide a button the user can
use when they are finished making changes to send the signals (I'm
also having to make this work in a distributed environment---a.k.a.,
a web farm).  The same script can also do any checking of
configuration files (run them through the appropriate Apache with the
-c flag).
-- 
James Smith <JG...@TAMU.Edu>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix