Common Stanzas

This module contains functions and variables that provide a variety of commonly used nginx config boilerplate.

nginx.config.common._gzip_options()[source]

These are some decent default settings for gzip compression

nginx.config.common._large_buffers()[source]

These are some larger than default buffer settings.

Use at your own risk!

nginx.config.common._statsd_options_location()[source]

These are some good defaults to supply to Nginx when using the statsd plugin.

https://github.com/zebrafishlabs/nginx-statsd

NB! it requires you to include a “statsd_server” directive in your http section. This set of common directives should go in any Location block.

nginx.config.common._uwsgi_cache()[source]

A set of useful defaults for using nginx’s response cache with uWSGI

This block of options belongs in your HTTP section.

NB! you must set “set $nocache 0;” in the Location block of your uwsgi backend.

see: http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html

nginx.config.common._uwsgi_cache_location()[source]

These are some decent defaults for caching uwsgi responses

nginx.config.common.ratelimit_options(qps)[source]

Rcreate rate limit shared memory zone, used for tracking different connections.

Parameters:qps (int|str) – Queries per second to rate limit.
nginx.config.common.ratelimit_options_location(burst_qps)[source]

This needs to be added to a location block in order for that location to get rate limiting

Parameters:burst_qps (int|str) – Queries per second to allow bursting to.