Accessing the location configuration of module 2 during post configuration processing of module 1 for a particular server

Maxim Dounin mdounin at
Tue Jun 10 14:52:33 UTC 2014


On Tue, Jun 10, 2014 at 02:09:13AM +0800, Rv Rv wrote:

> How do we access the configuration of a an unrelated module in a 
> given module. This may be required for example to check if the 
> directives pertaining to module 2 were specified in location for 
> a particular server that has directives for module 1 in its 
> configuration.

I don't think it's something you should do at postconfiguration - 
location structure is complex and not easily accessible.  There 
are location configuration merge callbacks where you are expected 
to work with location configs and, in particular, can use 
ngx_http_conf_get_module_loc_conf() macro to access a 
configuration of other modules (note though, that order of modules 
may be important in this case).


> I did not find any documentation on how the configuration is stored within nginx using these structs 

It's under src/, in C language.

I would rather say it's not a part of the API, and you'd better 
avoid using it directly.

Maxim Dounin

More information about the nginx mailing list