Welcome! Log In Create A New Profile

Advanced

What is the order of module execution and how can I change it?

Alexander Todorov
October 22, 2014 05:28AM
Hello folks,
I'm looking into nginx for developing custom modules and I'm missing some info
related to the order of module execution.

At http://www.evanmiller.org/nginx-modules-guide.html it says:
"
The order of their execution is determined at compile-time. Filters have the
classic "CHAIN OF RESPONSIBILITY" design pattern: one filter is called, does its
work, and then calls the next filter, until the final filter is called, and
Nginx finishes up the response.
"

Not a mention about non-filter modules. Then when trying to build nginx from
source I see a objs/ngx_modules.c file with:

ngx_module_t *ngx_modules[] = {
&ngx_core_module,
&ngx_errlog_module,
&ngx_conf_module,
&ngx_events_module,
&ngx_event_core_module,
&ngx_epoll_module,
&ngx_regex_module,
&ngx_http_module,
&ngx_http_core_module,
&ngx_http_log_module,

.... skip ...

&ngx_http_headers_filter_module,
&ngx_http_copy_filter_module,
&ngx_http_range_body_filter_module,
&ngx_http_not_modified_filter_module,
NULL
};


This looks like the order of execution of all modules, is this correct ?



If so, where can I place my modules in this list ? Only at the end or at
arbitrary positions? How do I do that (point me to docs is fine) ?

For example I'd like to have a custom logging module which executes after
ngx_http_log_module saving results to a DB for further analysis and BI purposes.

Another example is if I'd want to minify HTML content (a filter module) how do I
do that before gzip kicks in?

Thanks for any comments or helpers.

--
Alex

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

What is the order of module execution and how can I change it?

Alexander Todorov 711 October 22, 2014 05:28AM

Re: What is the order of module execution and how can I change it?

Maxim Dounin 841 October 22, 2014 12:40PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready