Unfortunately, the question is ambiguous.
You can put it into the structure, you initialized `mycf = ngx_pcalloc(cf->pool, size)`, where cf is `ngx_conf_t *cf`, if you want to save it per location. Then you can get it in the handler, using `mycf = ngx_http_get_module_loc_conf(r, ngx_http_your_module);`... There are many another places, where you can put it. E. g. just as static variable like `static int var`, so valid per module-scope. But you should provide more info what exactly you want do. For example another issue may be also multiple-workers at all (that are processes, not the threads in nginx), so if it should be exactly one counter across all workers, then you should put it into the shared memory (or somewhere in shared pools, using ngx_slab_alloc functions). The good example would be own nginx module "ngx_http_limit_conn_module". Because otherwise, each worker will just get its own counter. Regards, Serg. Am 09.02.2018 17:31, schrieb Antonio Nappa: > Hello, > > I am looking for a structure that I can use to store a counter in the module, > this structure should not be reset every time there is a new request. > > I have made tests with the module custom ctx and the module custom srv > configuration without success, which means every time there is a new request > the field becomes zero. > > Thanks, Antonio > > _______________________________________________ > nginx-devel mailing list > firstname.lastname@example.org > http://mailman.nginx.org/mailman/listinfo/nginx-devel  Links: ------  http://mailman.nginx.org/mailman/listinfo/nginx-devel
_______________________________________________ nginx-devel mailing list email@example.com http://mailman.nginx.org/mailman/listinfo/nginx-devel