Table of Contents

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.