google / ngx_brotli

NGINX module for Brotli compression
BSD 2-Clause "Simplified" License
2.1k stars 215 forks source link

Why on earth is this so complicated to install in Ubuntu AND have it auto-update? #140

Open FlowsterApp opened 2 years ago

FlowsterApp commented 2 years ago

I'm hoping I just suck at Googling :stuck_out_tongue_winking_eye: and there's a much simpler solution out there that I just haven't found yet.

So initially we followed these instructions: https://github.com/google/ngx_brotli#installation

And it was working fine for weeks. But then we upgraded packages on the server (apt update; apt upgrade), and rebooted the server, and then sadly nginx would not start.

The error log showed: [emerg] 3436#3436: module "/etc/nginx/modules/ngx_http_brotli_filter_module.so" version 1022000 instead of 1022001 in /etc/nginx/nginx.conf:10

So in order to get nginx back up as quick as possible, we simply commented-out all the brotli-related links in nginx.conf and started it up.

I guess this means the "install process" listed above is for a 1-time manual install, and package updates don't work properly after that point? :thinking:

So then we found this guide, but holy moly is it ever complicated. It seems like there's too many moving parts and something could definitely break in the future: https://devopsan.com/how-to-install-auto-upgrade-nginx-brotli-module-on-ubuntu/

Is there really no simple way to install brotli w/ nginx on Ubuntu AND have it automatically update without breaking nginx? :grimacing:

Thanks in advance!

dhanushreddy291 commented 1 year ago

and don't even talk about installing this on an NGINX Docker container. I have been stuck since 2 days. Looks like NGINX Plus has all features prebuilt and NGINX Opensource is where all the manual labor work is being done.

abcfy2 commented 1 year ago

There's someone already built deb for you. You may try https://github.com/darylounet/libnginx-mod-brotli

jnoordsij commented 1 year ago

and don't even talk about installing this on an NGINX Docker container. I have been stuck since 2 days. Looks like NGINX Plus has all features prebuilt and NGINX Opensource is where all the manual labor work is being done.

Actually the official nginx docker image has a very nice of example on how to install additional modules, see https://github.com/nginxinc/docker-nginx/tree/master/modules. As this module is part of pkg-oss, simply passing ENABLED_MODULES="brotli" will work.

kkgowtamasa commented 1 year ago

any solution is much appreciated. Right now I'm trying to use the docker image georgjung/nginx-brotli but again precomplied / already compressed static assets are not getting de-compressed when the application is launched on chrome.

Danrancan commented 7 months ago

Unless you are using a repository that automatically provides this module, you need to compile the module from source with each update. Then add the dynamic modules to your Nginx modules directory. Be sure to compile against the updated nginx, not the old one.

vardumper commented 1 month ago

There seems to be pre-compiled packages one can install with apt.

apt install libnginx-mod-http-brotli-filter
apt install libnginx-mod-http-brotli-static

Unfortunately these don't seem to be compatible with the latest versions of nginx (as of today nginx 1.26.2 stable or 1.27.2 mainline).

sudo apt-get install nginx=1.24.0-2ubuntu7.1
sudo apt-mark hold nginx

So prior, one has to downgrade nginx. And I'm not sure if I like this...