Opened 4 years ago

Closed 4 years ago

#2046 closed enhancement (worksforme)

Suggestion: enable detailes for error "Failed to start A high performance web server and a reverse proxy server.

Reported by: DarkTrick@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.14.x
Keywords: log Cc:
uname -a: Linux jitsiserver 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.14.2 built with OpenSSL 1.1.1d 10 Sep 2019 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-Cjs4TR/nginx-1.14.2=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-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=/var/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-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_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-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-echo --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-subs-filter

Description

Starting nginx via systemctl might result in the systemd error
"Failed to start A high performance web server and a reverse proxy server.".

Suggestion:

In case nginx could not be started, log the cause detailed in /var/log/nginx/error.log.
Defining *detailed*: In case of a faulty config file under /etc/nginx/sites-available, state the full qualified file path and the line, that caused the error. If the line cannot be determined, state the information that caused the problem. E.g. "ssl.key path "/yadayada.key" could not be found.

The error level of this error should be CRITICAL (log on every log level), as it prevents the application to start.

Actual:

Nothing is logged on behalf of ngnix.

Change History (1)

comment:1 by Maxim Dounin, 4 years ago

Resolution: worksforme
Status: newclosed

As long as nginx cannot start due to its own problems, for example, due to configuration errors, it logs appropriate errors at the "emerg" level, with detailed information in the log message, including full path and line. For example:

2020/09/16 16:08:50 [emerg] 29149#29149: unexpected end of file, expecting ";" or "}" in /etc/nginx/sites-enabled/badfile:5

The same error is also printed to stderr (and can be seen via systemctl status nginx in case of systemd).

If you don't see the error, most likely the cause of the error is not under nginx control.

Note: See TracTickets for help on using tickets.