How to install and enable brotli compression on LEMP on ubuntu 18.04

Hello fellows,

I need some help. I have enabled gzip compression but I also want to enable brotli compression on my server. I followed many articles available on google but none of them helped me to install and enable brotli.

I also don’t trust another source. I followed all the articled by the digital ocean to install my LEMP stack and WordPress. But I think there is no tutorial available for brotli. I also checked official doc of Nginx but there is not enough information. I followed their doc to install brotli but that did not work for me.

Please if anyone here can tell me the best and clean method to enable brotli. I will appreciate that.

Thanks & Regards, Brajmohan Kumar

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


To install brotli you need to execute these commands:

sudo apt update
sudo apt install -y build-essential gcc make bc sed autoconf automake libtool git apt-transport-https tree
git clone
cd brotli
sudo cp ~/brotli/docs/brotli.1 /usr/share/man/man1 && sudo gzip /usr/share/man/man1/brotli.1
sudo make install
sudo ldconfig

After that check version with this command brotli --version

Hope this helps