'Problem with brotli configuration in nginx

I am following this guide https://www.vultr.com/docs/add-brotli-support-to-nginx-on-ubuntu-18-04

I have followed every step but I am stuck at Step 4 – Configure Nginx

When I add to nginx.conf

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

I get this error after running sudo nginx -t:

nginx: [emerg] dlopen() "/usr/share/nginx/modules/ngx_http_brotli_filter_module.so" failed (/usr/share/nginx/modules/ngx_http_brotli_filter_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:6
nginx: configuration file /etc/nginx/nginx.conf test failed

What might cause that? Thank you!

Hosting provider: DigitalOcean Server running: Ubuntu 20.04 LEMP Nginx version: 1.17.10



Solution 1:[1]

I had the same issue 2 years back and after a lot of reading and research got it working. Hope this helps. I have provided step by step instruction in the answer.

ngx_http_brotli_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf:1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 invinciblemuffi