In this chapter, we saw how a NGINX configuration file is built. Its modular nature is a reflection, in part, of the modularity of NGINX itself. A global configuration block is responsible for all aspects that affect the running of NGINX as a whole. There is a separate configuration section for each protocol that NGINX is responsible for handling. We may further define how each request is to be handled by specifying servers within those protocol configuration contexts (either http
or mail
) so that requests are routed to a specific IP address/port. Within the http
context, locations are then used to match the URI of the request. These locations may be nested, or otherwise ordered to ensure that requests get routed to the right areas of the filesystem or application server.
What we did not cover in this chapter are the configuration options provided by the various modules that may be compiled into your nginx
binary. These additional directives will be touched upon throughout the book...