Score:0

Can't start Nginx, Brotli configuration error

th flag

I have a nginx server setup as a reverse proxy for apache2 on a Debian 9 OS. Apache2 is running on a different port than 80. I was trying to renew my site's certificate using certbot, and I ran this command somewhere during the process:

$ sudo apt install python3-certbot-nginx

I think that this installed a fresh copy of nginx server on my machine(correct me if I am wrong please) and since then nginx hasn't been able to start. Following are the results from the test commands:

nginx -t:

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

nginx -V:

nginx version: nginx/1.10.3
built with OpenSSL 1.1.0l  10 Sep 2019
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-8G38mz/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --er
ror-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/va
r/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-tem
p-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_r
equest_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-
http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic 
--with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-8G38mz/nginx-1.10.3/debian/modules/nginx-auth-pam --add-dynamic-m
odule=/build/nginx-8G38mz/nginx-1.10.3/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-8G38mz/nginx-1.10.3/debian/modules/nginx-echo --add-dynami
c-module=/build/nginx-8G38mz/nginx-1.10.3/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-8G38mz/nginx-1.10.3/debian/modules/ngx_http_substitution
s_filter_module

sudo systemctl status nginx:

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2022-04-11 01:20:12 CEST; 14min ago
     Docs: man:nginnginx: [emerg] dlopen() "/usr/share/nginx/nginx/modules/ngx_http_brotli_filter_module.so" failed (/usr/share/nginx/nginx/modules/ngx_http_brotli_filter_module.so: cann
ot open shared object file: No such file or directory) in /etc/nginx/modules.conf.d/brotli.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failedx(8)
  Process: 22395 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Apr 11 01:20:12 cp-com-vm systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 11 01:20:12 cp-com-vm nginx[22395]: nginx: [emerg] dlopen() "/usr/share/nginx/nginx/modules/ngx_http_brotli_filter_module.so" failed (/usr/share/nginx/nginx/module
Apr 11 01:20:12 cp-com-vm nginx[22395]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 11 01:20:12 cp-com-vm systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 11 01:20:12 cp-com-vm systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Apr 11 01:20:12 cp-com-vm systemd[1]: nginx.service: Unit entered failed state.
Apr 11 01:20:12 cp-com-vm systemd[1]: nginx.service: Failed with result 'exit-code'.

nginx.conf:

   #user  nginx;
 worker_processes  1;

#error_log  /var/log/nginx/error.log;
 #error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

 #pid        /var/run/nginx.pid;

 include /etc/nginx/modules.conf.d/*.conf;

events {
worker_connections  1024;
}

 http {
include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
#tcp_nodelay        on;

#gzip  on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";

server_tokens off;

include /etc/nginx/conf.d/*.conf;
client_max_body_size 512M;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;

brotli.conf:

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

I have tried a lot of answers from different sites on how to get my server back up to no avail, can someone please pinpoint to the exact problem? FYI-I was able to renew the certificate afterwards, so now I am only left with this problem. TIA

djdomi avatar
za flag
Are you confident that you have Brotli? Because Brotli is not a standard included module, try to comment it out or remove the config.
th flag
@djdomi I don't understand where am I supposed to comment it out, in the brotli.conf file or somewhere else?
Score:0
th flag

No matter what I tried, I wasn't able to fix my then current installation of nginx. My nginx.conf always failed even though I installed brotli separately and tried commenting it in the configuration.

I had to purge the instance of nginx and reinstall it to get it up and running again:

apt-get purge nginx nginx-common nginx-full
apt-get install nginx
djdomi avatar
za flag
Basically you had just to remove the brotli.conf out of the modules
th flag
@djdomi I tried that. Didn't work, i even tried turning Brotli off in the conf.
djdomi avatar
za flag
this fact was not told at all in the current progress, remember that you need to accept your own answer
th flag
Oh yes. Thank you for the reminder.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.