Nginx - Grammar

About

A page about the grammar of Nginx

Syntax

Directive

nginx consists of modules which are controlled by directives specified in the configuration file.

Directives are divided into simple directives and block directives.

Simple

  • A simple directive consists of the name and parameters separated by spaces and ends with a semicolon ;.

Block

A block directive consists of the name and parameters and a set of additional instructions surrounded by braces ({ and }).

Scope

Directives placed in the configuration file outside of any contexts are considered to be in the main context. The events and http directives reside in the main context, server in http, and location in server.

Conditional

Condition are in the rewrite module. For example, the If directive

Comment

The rest of a line after the # sign is considered a comment.





Discover More
Nginx - Block

block in Nginx is a grammar construct of the directive type. It groups: name and parameters and a set of additional instructions surrounded by braces ({ and }). See If a block directive can...
Nginx - Http Block

The http block is a block that contains http parameters (directive).



Share this page:
Follow us:
Task Runner