You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Andrew Godziuk <an...@cloudaccess.net> on 2010/06/01 11:39:47 UTC

Can an Apache module inject configuration in runtime?

Hi,

First of all, hi to the Apache developers, I'm new to this list - nice
to meet you all.

I'm wondering if it's possible for an Apache module to change global
config structures.

What I want to achieve is injecting new vhosts without Apache restart.
Of course I'm aware that the changes would fully take effect after all
workers have recycled, but for me - it's still better than a restart.

I've written an Apache module before, but the configuration is an
unknown land to me. While reading config.c, I noticed that a function
called ap_build_config() could be helpful, but how do I call it to do
what I need? Is it at all possible?

-- 
Andrew

Re: Can an Apache module inject configuration in runtime?

Posted by Andrew Godziuk <an...@cloudaccess.net>.
On Tue, Jun 1, 2010 at 11:51 AM, Ben Noordhuis <in...@bnoordhuis.nl> wrote:
> Andrew, wouldn't you be better off with something like
> mod_vhost_alias, as-is or as leitmotiv? Propagating configuration
> changes to all workers is rather difficult, especially with pre-fork
> MPMs.


Unfortunately, I need some suexec mechanism, currently I'm using
mpm_itk, so I need some per-vhost settings, it's not available with
mod_vhost_alias style dispatch-time modules. At least, as far as I
understand how they work.


-- 
Andrew

Re: Can an Apache module inject configuration in runtime?

Posted by Ben Noordhuis <in...@bnoordhuis.nl>.
On Tue, Jun 1, 2010 at 11:39, Andrew Godziuk <an...@cloudaccess.net> wrote:
> What I want to achieve is injecting new vhosts without Apache restart.
> Of course I'm aware that the changes would fully take effect after all
> workers have recycled, but for me - it's still better than a restart.

Andrew, wouldn't you be better off with something like
mod_vhost_alias, as-is or as leitmotiv? Propagating configuration
changes to all workers is rather difficult, especially with pre-fork
MPMs.

Re: Can an Apache module inject configuration in runtime?

Posted by Andrew Godziuk <an...@cloudaccess.net>.
On Tue, Jun 1, 2010 at 11:47 AM, William A. Rowe Jr.
<wr...@rowe-clan.net> wrote:

> If you don't do this during startup, beware.  You are exploding memory by
> taking what were copy-on-write shadow pages of the original parent process,
> and munging X copies where X is the number of worker processes you have.
> And if it is threaded, outch.


So I guess that for the sake of speed, there is no IPC lock I can use
to change them?


-- 
Andrew

Re: Can an Apache module inject configuration in runtime?

Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 6/1/2010 4:39 AM, Andrew Godziuk wrote:
> 
> I'm wondering if it's possible for an Apache module to change global
> config structures.

If you don't do this during startup, beware.  You are exploding memory by
taking what were copy-on-write shadow pages of the original parent process,
and munging X copies where X is the number of worker processes you have.
And if it is threaded, outch.

Re: Can an Apache module inject configuration in runtime?

Posted by Nick Kew <ni...@apache.org>.
On 1 Jun 2010, at 10:39, Andrew Godziuk wrote:

> I'm wondering if it's possible for an Apache module to change global
> config structures.

Basically, no, not without a restart.  Though there are some aspects of
configuration you can change on the fly.

> What I want to achieve is injecting new vhosts without Apache restart.
> Of course I'm aware that the changes would fully take effect after all
> workers have recycled, but for me - it's still better than a restart.

There are some similar modules around.  Someone already said
mod_vhost_alias, but I'd also point you at mod_vhost_dbd as an
example that may be nearer to what you want if your needs are
sufficiently complex to demand a new module.

-- 
Nick Kew