/nginx-config-example

An example of a complex NginX configuration based on best practices

Primary LanguageHTMLApache License 2.0Apache-2.0

nginx-config-example Build Status

This is a complex NginX configuration example that incorporates much of what I have learned about running NginX for years at scale at several large sites I've been involved with.

The most interesting features are:

  • A rich set of includes to add functionality at the server block or location block level.
  • The use of maps to do complex conditionals instead of trying to rely on the limited "if".
  • The use of chained "geo" and "map" to do conditional rate-limiting.

There are other goodies sprinkled throughout.

It is meant to be used as the basis for your own NginX config. Copy and modify it, removing the parts that aren't relevant to you.