Disallowing multiple http {} blocks in nginx.conf?

Maxim Dounin mdounin at mdounin.ru
Thu Oct 10 20:21:26 UTC 2013


Hello!

On Thu, Oct 10, 2013 at 12:46:03PM -0700, Yichun Zhang (agentzh) wrote:

> Hello guys!
> 
> Some Nginx users use multiple http {} blocks in their nginx.conf, which
> causing issues because following http {} blocks override previous http
> modules' main_conf leading inconsistencies in calls
> like ngx_http_conf_get_module_main_conf
> and ngx_http_cycle_get_module_main_conf in global handler contexts like
> "post configuration" handlers.
> 
> Do you think it is a good idea to simply disallow multiple http {} blocks
> in nginx.conf?

I don't thinks that it's a good idea to disallow configurations 
with multiple http{} blocks.  While this wasn't claimed to be 
supported, it allows fun things like running multiple 
configuration isolated, and e.g. makes merging configs from 
multiple servers much easier.

AFAIR, as of now only one of standard modules has problems with 
this - embeeded perl, and it has appropriate "caveat emptor" 
clause in it's documentation.  

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list