Question regarding syntax of nginx configs

Maxim Dounin mdounin at mdounin.ru
Mon Nov 16 14:24:58 UTC 2015


Hello!

On Sun, Nov 15, 2015 at 02:14:25PM +0530, Awal Garg wrote:

> Heyo!
> 
> I am writing a configuration parser for nginx (in Python). It appears
> as if the following constructs are dismissed as invalid by
> https://github.com/nginx/nginx/blob/master/src/core/ngx_conf_file.c#l636:
> 
> ```
> ...<STRING_TOKEN> <BLOCK> <STRING_TOKEN>;
> ```
> and
> ```
> ...<STRING_TOKEN> <BLOCK>;
> ```
> 
> (STRING_TOKEN is any token like `server` or `listen`. I don't really
> know what to call them here :/)
> 
> IOW, it seems that for every directive, a leaf representing a block
> can only come at the end of a directive and must not be followed by a
> statement-terminator.
> 
> Am I correct in inferring this?

Yes.

> Does this mean there isn't any
> directive possible which takes more than one block at once?

Yes.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list