Mastering Nginx

(Ron) #1

A Configuration Guide


The NGINX configuration file follows a very logical format. Learning this format


and how to use each section is one of the building blocks that will help you to create
a configuration file by hand. This chapter will help you reach that goal by explaining


the following topics:



  • Basic configuration format

  • NGINX global configuration parameters

  • Using include files

  • The HTTP server section

  • The virtual server section

  • Locations – where, when, and how

  • The mail server section

  • Full sample configuration


The basic configuration format


The basic NGINX configuration file is set up in a number of sections. Each section
is delineated in the following way:


<section> {

<directive> <parameters>;

}

It is important to note that each directive line ends with a semicolon (;). This marks


the end-of-line. The curly braces ({}) actually denote a new configuration context,
but we will read these as "sections" for the most part.

Free download pdf