Celeb Glow
news | March 17, 2026

Installing nginx-module-brotli on Ubuntu Errors

I have been trying to set up Brotli compression on Nginx, but am failing at the package installation step.

In particular, when I run sudo apt install nginx-module-brotli, I get this

The following packages have unmet dependencies: nginx-module-brotli : Depends: nginx (= 1.17.3-2-ppa7~bionic)
E: Unable to correct problems, you have held broken packages.

However, my Nginx version seems to match

nginx -V
nginx version: nginx/1.17.3
built by gcc 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
built with OpenSSL 1.1.1 11 Sep 2018
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.17.3/debian/debuild-base/nginx-1.17.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

Any advice on how to fix this is appreciated. I have tried updating to the newest Nginx (1.20.x), but the same thing persists. I have also tried compiling it from scratch using THIS guide here with same results.

Edit: Per request in comments

> (base) ubuntu@host:~$ sudo apt update Hit:1
> bionic InRelease Hit:2
> bionic-updates
> InRelease Hit:3
> bionic-backports
> InRelease Get:4
> bionic-security InRelease [88.7 kB]
> Hit:5 bionic
> InRelease Hit:6
> bionic InRelease
> Hit:7 bionic InRelease
> Fetched 88.7 kB in 1s (145 kB/s) Reading package lists... Done
> Building dependency tree Reading state information... Done 47
> packages can be upgraded. Run 'apt list --upgradable' to see them.
>
> (base) ubuntu@host:~$ sudo apt install nginx Reading
> package lists... Done Building dependency tree Reading state
> information... Done The following NEW packages will be installed:
> nginx 0 upgraded, 1 newly installed, 0 to remove and 47 not upgraded.
> Need to get 877 kB of archives. After this operation, 3,074 kB of
> additional disk space will be used. Get:1
> bionic/nginx amd64 nginx amd64
> 1.20.2-1~bionic [877 kB] Fetched 877 kB in 1s (668 kB/s) Selecting previously unselected package nginx. (Reading database ... 149038
> files and directories currently installed.) Preparing to unpack
> .../nginx_1.20.2-1~bionic_amd64.deb ...
> ----------------------------------------------------------------------
>
> Thanks for using nginx!
>
> Please find the official documentation for nginx here:
> *
>
> Please subscribe to nginx-announce mailing list to get the most
> important news about nginx:
> *
>
> Commercial subscriptions for nginx are available on:
> *
>
> ---------------------------------------------------------------------- Unpacking nginx (1.20.2-1~bionic) ... Setting up nginx
> (1.20.2-1~bionic) ... nginx: [warn] the "ssl" directive is deprecated,
> use the "listen ... ssl" directive instead in
> /etc/nginx/sites-enabled/zdravost:22 Processing triggers for man-db
> (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21)
> ... Processing triggers for systemd (237-3ubuntu10.50) ...
7

1 Answer

It seems like you are having two repositories which provide the same package I.e nginx. However, one of those repositories also contain, nginx-module-brotli which depends on nginx (= 1.17.3-2-ppa7, which is provided by the hda-me/nginx-stable PPA. You must remove the other PPAs which provide the same package I.e nginx because its confusing apt about which package to install. APT is mistakenly installing the wrong version. You must remove other repository, so that only one version is left. The wrong PPA here is nginx/stable which provides version: 1.20.2. The correct one is hda-me/nginx-stable which provides version: 1.17.3-2-ppa7 which is required by nginx-module-brotli.

  1. Remove the wrong PPA:

    sudo apt-add-repository --remove nginx/stable
  2. Update:

    sudo apt update
  3. Remove the wrong version of nginx:

    sudo apt remove nginx
  4. Install the correct version of nginx:

    sudo apt install nginx
  5. Install the required package:

    sudo apt install nginx-module-brotli

Alternatively, you can achieve the same using reinstalling the correct package version. However, this is NOT recommended because this may cause dependency troubles, may lead to broken packages or prevent packages from upgrading:

sudo apt install --reinstall nginx=1.17.3-2-ppa7~bionic nginx-module-brotli

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy