Nginx kann nicht gestartet werden, Brotli-Konfigurationsfehler

Nginx kann nicht gestartet werden, Brotli-Konfigurationsfehler

Ich habe einen Nginx-Server als Reverse-Proxy für Apache2 auf einem Debian-9-Betriebssystem eingerichtet. Apache2 läuft auf einem anderen Port als 80. Ich habe versucht, das Zertifikat meiner Site mit Certbot zu erneuern, und habe irgendwann während des Vorgangs diesen Befehl ausgeführt:

$ sudo apt install python3-certbot-nginx

Ich glaube, dadurch wurde eine neue Kopie des Nginx-Servers auf meinem Rechner installiert (korrigieren Sie mich bitte, wenn ich falsch liege) und seitdem konnte Nginx nicht mehr gestartet werden. Nachfolgend sind die Ergebnisse der Testbefehle aufgeführt:

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;

Ich habe viele Antworten von verschiedenen Websites ausprobiert, um meinen Server wieder zum Laufen zu bringen, aber ohne Erfolg. Kann mir bitte jemand das genaue Problem nennen? Zu Ihrer Information: Ich konnte das Zertifikat anschließend erneuern, sodass ich jetzt nur noch dieses Problem habe. TIA

Antwort1

Egal, was ich versuchte, ich konnte meine damalige aktuelle Nginx-Installation nicht reparieren. Meine nginx.conf schlug immer fehl, obwohl ich Brotli separat installiert und versucht hatte, es in der Konfiguration zu kommentieren.

Ich musste die Instanz von Nginx bereinigen und neu installieren, um sie wieder zum Laufen zu bringen:

apt-get purge nginx nginx-common nginx-full
apt-get install nginx

verwandte Informationen