UPDATE: nginx support for brotli is now in Debian!. I've removed my fork as I am no longer maintaining it, please move onto Debian's official package.
Debian does not yet ship ngx_brotli (libnginx-mod-brotli) so I've compiled Ondřej Surý's work so it can be used by everyone on Debian bullseye (Debian 11) and buster (Debian 10).
To install, download the latest version of the .deb from the GitHub releases page and install it with:
sudo dpkg -i libnginx-mod-brotli*.deb
Next, you must enable the module:
sudo ln -s /usr/share/nginx/modules-available/mod-brotli.conf /etc/nginx/modules-enabled/50-mod-brotli.conf
Edit your nginx configuration in /etc/nginx
to make use of ngx_brotli. Typically, this means adding brotli_static on;
or brotli on;
to the relevant parts of your configuration.
Finally, restart nginx to load the new configuration and modules:
sudo systemctl restart nginx
And that's it!
Frequently asked questions
Help! I'm trying to install a security update for nginx or update nginx on my system. Apt is forcing me to uninstall libnginx-mod-brotli because its dependencies are unmet. What do I do?
You must install the version of libnginx-mod-brotli that precisely matches the version of nginx on your system. Download a new version from the GitHub releases page and reinstall that. If a new version is not available yet please open an issue on the GitHub page and I will upload a new version as soon as I can. It may be prudent to uninstall libnginx-mod-brotli before updating nginx and re-install the new version of libnginx-mod-brotli immediately after updating nginx to avoid complications with apt.
Can you provide an apt repo with this package in it?
Maybe later!