ngx_brotli
Brotli compression for responses and static assets
Overview
ngx_brotli adds Brotli compression to nginx. Brotli is a compression format developed at Google that typically produces smaller output than gzip at comparable speed, and every modern browser advertises support for it in the Accept-Encoding header.
The project ships two modules. The filter module compresses responses on the fly, and the static module serves pre-compressed .br files from disk so no CPU is spent at request time.
Google maintains the module. It is one of the most widely deployed third-party nginx modules and is compiled into most distribution builds. Our package installs a ready-made /etc/nginx/snippets/brotli.conf; include it from nginx.conf to switch it on.
Key directives
brotliEnables on-the-fly Brotli compression of responses; off by default.brotli_comp_levelSets the compression quality from 0 to 11, default 6.brotli_typesLimits compression to the listed MIME types, default text/html.brotli_min_lengthSkips responses shorter than the given byte length, default 20.brotli_staticServes a pre-compressed .br file next to the original when the client accepts Brotli.brotli_windowSets the sliding window size used during compression, default 512k.Example
Availability
Ships as a dynamic module in libnginx-mod-http-brotli, installed with nginx, nginx-full and nginx-extras. The package drops a load_module config into /etc/nginx/modules-enabled/, so it loads on start.