How to access module configs from init_process
August 25, 2015 12:17PM
I'm trying to figure out how to access http upstream module's config from init process handler.

I tried:

static ngx_int_t
ngx_http_upstream_lb_init_process(ngx_cycle_t *cycle)
{
ngx_http_conf_ctx_t *conf_ctx;
ngx_http_upstream_srv_conf_t *uscf;

.....
// 1.
conf_ctx = ((ngx_http_conf_ctx_t *)cycle->conf_ctx[ngx_http_module.index]);

uscf = ((ngx_http_upstream_srv_conf_t *)cycle->conf_ctx[ngx_http_upstream_module.index]);

// 2.
uscf = ngx_event_get_conf(cycle->conf_ctx, ngx_http_upstream_module);
.....
}


Neither works for me.

Neither can I access my own module's configs (upstream, location, ...)

Thank you.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 297
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