nginx startup logging error, at odds with documentation

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Robert Vollmert
Owner
unassigned
Submitted by
Robert Vollmert
Severity
normal
R
R
Robert Vollmert wrote on 26 Jun 2019 07:18
(address . bug-guix@gnu.org)
A8BEB5E8-9002-4BE4-8CA3-99AA90819851@vllmrt.net
The documentation states:

At startup, ‘nginx’ has not yet read its configuration file, so it
uses a default file to log error messages. If it fails to load its
configuration file, that is where error messages are logged. After the
configuration file is loaded, the default error log file changes as per
configuration. In our case, startup error messages can be found in
‘/var/run/nginx/logs/error.log’, and after configuration in
‘/var/log/nginx/error.log’. The second location can be changed with the
LOG-DIRECTORY configuration option.

But I see:

creating nginx log directory '/var/log/nginx'
creating nginx run directory '/var/run/nginx'
creating nginx temp directories '/var/run/nginx/{client_body,proxy,fastcgi,uwsgi,scgi}_temp'
nginx: [alert] could not open error log file: open() "/gnu/store/byd116qs89b0am4zwjf4vjai7qlskvaw-nginx-1.17.0/logs/error.log" failed (2: No such file or directory)

It seems the documentation assumes nginx’s prefix directory is /var/run/nginx
instead of in the store. Some likely ways to improve this would be to pass
`-p /var/run/nginx` or `-g “error_log /var/log/nginx/error.log”` as command
line flags when starting nginx:

$ /gnu/store/byd116qs89b0am4zwjf4vjai7qlskvaw-nginx-1.17.0/sbin/nginx -h
nginx version: nginx/1.17.0
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /gnu/store/byd116qs89b0am4zwjf4vjai7qlskvaw-nginx-1.17.0/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
R
R
Robert Vollmert wrote on 26 Jun 2019 20:23
activation?
(address . 36388@debbugs.gnu.org)
AF2533FB-3879-44EC-97E9-1CEA16660456@vllmrt.net
Could it be that the errors happen in the activation script,
but not when actually starting nginx? I see in the code that
we appear to pass a “-p” flag already when starting nginx;
maybe we should simply do the same when testing the config
during activation?
L
L
Ludovic Courtès wrote on 27 Jun 2019 17:21
(name . Robert Vollmert)(address . rob@vllmrt.net)(address . 36388@debbugs.gnu.org)
87r27fxddg.fsf@gnu.org
Hi,

Robert Vollmert <rob@vllmrt.net> skribis:

Toggle quote (6 lines)
> Could it be that the errors happen in the activation script,
> but not when actually starting nginx? I see in the code that
> we appear to pass a “-p” flag already when starting nginx;
> maybe we should simply do the same when testing the config
> during activation?

Probably, that must be where the error comes from.

Ludo’.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 36388@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 36388
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch