How to control the order of execution modules in nginx
mdounin at mdounin.ru
Thu Jan 30 12:08:39 UTC 2014
On Thu, Jan 30, 2014 at 01:05:34PM +0800, Rv Rv wrote:
> From http://www.evanmiller.org/nginx-modules-guide.html, "The
> order of their execution is determined at compile-time". Is
> there a way to control this. ngx_modules.c has the list and
> order of execution. How do I change the order of execution of
> modules within a particular phase e.g. if I have three modules
> within the access phase, is there a way to control the order of
> execution with the access phase.
Order of execution of modules in a particular phase is set during
a configure, modules which are last in HTTP_MODULES are executed
That is, if you want to add "module1", "module2", and "module3",
all of them use the access phase, and each of them does something
in it's "config" file, you should do something like
./configure --add-module=module3 \
to get the "module1 -> module2 -> module3" order.
Note that it may non-trivial to, e.g., make sure your module is
called after standard modules in the access phase.
More information about the nginx