Module NGINX模块退出线程/主回调
我的小nginx模块遇到了一些麻烦(和头痛)。 我最近看到了很多模块代码,还有很多关于nginx模块的东西,但我无法做到我需要做的。 我的问题是: 我已经创建了自己的nginx模块,名为“mymodule”。其loc_conf结构如下所示:Module NGINX模块退出线程/主回调,module,nginx,httpserver,Module,Nginx,Httpserver,我的小nginx模块遇到了一些麻烦(和头痛)。 我最近看到了很多模块代码,还有很多关于nginx模块的东西,但我无法做到我需要做的。 我的问题是: 我已经创建了自己的nginx模块,名为“mymodule”。其loc_conf结构如下所示: typedef struct { void *serverConf; ngx_str_t server_file; } ngx_http_mymodule_loc_conf_t; static ngx_command_t ngx_http_
typedef struct {
void *serverConf;
ngx_str_t server_file;
} ngx_http_mymodule_loc_conf_t;
static ngx_command_t ngx_http_mymodule_commands[] = {
{
ngx_string("mymodule"),
NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
ngx_http_mymodule,
NGX_HTTP_LOC_CONF_OFFSET,
0,
NULL
},
ngx_null_command
};
其指挥结构如下:
typedef struct {
void *serverConf;
ngx_str_t server_file;
} ngx_http_mymodule_loc_conf_t;
static ngx_command_t ngx_http_mymodule_commands[] = {
{
ngx_string("mymodule"),
NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
ngx_http_mymodule,
NGX_HTTP_LOC_CONF_OFFSET,
0,
NULL
},
ngx_null_command
};
在ngx_http_mymodule函数中,我做了一些工作,并在ngx_http_mymodule_loc_conft中设置serverConf指针。
问题是我想在线程/进程退出时检索serverConf指针。但是在退出线程进程或主进程时,给ngx_module_t的唯一参数是ngx_cycle_t*,我找不到如何从中检索ngx_http_mymodule_loc_conf_t以便处理serverConf指针
[编辑]
我在线程退出回调中尝试了这一点,但没有找到一个非空的serverConf指针:
ngx_http_mymodule_loc_conf_t *mymodulecf = (ngx_http_mymodule_loc_conf_t *)ngx_get_conf(cycle->conf_ctx, ngx_http_mymodule_module);
任何帮助或想法都将不胜感激:)提前谢谢