Setting up Brotli on Nginx or Phoenix
Brotli is a relatively new compression format that has two big advantages over gzip. It’s faster at compressing things and it compresses them down to nearly ~25% smaller files!
Let’s set up our Nginx server to serve brotli compressed HTML, CSS, JS and JSON assets! If you’re running Phoenix, Rails, Django, Node or anything else behind an Nginx proxy, this setup should work for you.
A basic strategy is also covered for serving brotli compressed assets from a Phoenix server running directly on the server without anything proxying in front of it.
Read next Elixir Protocols: a gentle introduction