Disable default error_log?

Hi,

It seems something in nginx has changed: I can no longer run it in
isolation as a user. Even if I disable or move all log files to a
place the user has control over, nginx will still try to open
“/var/log/nginx/error.log”. Is this path hard-coded, or is it possible
to change it?

This the output I get when trying to run nginx with a custom
configuration file:

$ nginx -g ‘error_log /dev/null crit;’ -q -c mynginx.conf
nginx: [alert] could not open error log file: open()
“/var/log/nginx/error.log” failed (13: Permission denied)


Johan B.

On 10 May 2012 09:07, Johan B. [email protected] wrote:

$ nginx -g ‘error_log /dev/null crit;’ -q -c mynginx.conf
nginx: [alert] could not open error log file: open()
“/var/log/nginx/error.log” failed (13: Permission denied)

http://wiki.nginx.org/NginxMainModule#error_log seems to suggest that
you’ll have this problem since 0.7.53. Does that fit in with the
timeline of your “something […] has changed”, above?

If so, “known issue”.

If not, something else may have changed - perhaps the order in which
the -g/-c parameters are examined (a complete guess, of course) - and
you should continue shouting about it :slight_smile:

J

Jonathan M.
Oxford, London, UK
http://www.jpluscplusm.com/contact.html

On Sat, May 12, 2012 at 1:06 AM, Jonathan M.
[email protected] wrote:

http://wiki.nginx.org/NginxMainModule#error_log seems to suggest that
you’ll have this problem since 0.7.53. Does that fit in with the
timeline of your “something […] has changed”, above?

If so, “known issue”.

Hmm, I’ve gone through my apt logs (debian), and this is what I get:
0. nginx is installed

  1. upgrade: 1.1.17-2 -> 1.1.18-1
  2. upgrade: 1.1.18-1 -> 1.1.19-1

I cannot see any trace of an nginx older than 1.1.17-2, which I’m
guessing is newer than 0.7.53.
So either I’ve had an old install of nginx which did not use the
package system, or this problem did not exist with one of the versions
listed.

I can try downgrading and see if it changes anything or not.


Johan B.

On Tue, May 15, 2012 at 1:51 PM, Jonathan M.
[email protected] wrote:

On 14 May 2012 15:58, Johan B. [email protected] wrote:

I can try downgrading and see if it changes anything or not.

Since nginx is a single binary, I suggest you might be able to extract
the binary from the old package and have both on the system in
parallel. This would let you give us the output from 2 versioned runs.
Kind of like

Alright, so I checked out the SVN repo and built the earlier versions.
No change. I tried 1.1.15-1.2.0 and every version gave the error.

I must have somehow upgraded from a 0.* version without my package
manager noticing it. Strange.


Johan B.

On 14 May 2012 15:58, Johan B. [email protected] wrote:

I can try downgrading and see if it changes anything or not.

Since nginx is a single binary, I suggest you might be able to extract
the binary from the old package and have both on the system in
parallel. This would let you give us the output from 2 versioned runs.
Kind of like

[email protected]:~$ nginx-1.1.18 -g "blah"
nginx: [alert] could not open error log file: open()
"/var/log/nginx/error.log" failed (13: Permission denied)
2012/05/15 12:48:49 [emerg] 25887#0: unexpected end of parameter,
expecting ";" in command line
[email protected]:~$ nginx-1.1.17 -g "blah"
[... nginx is running fine ]

With some -V invocations in there to show the compile-time settings,
too.

HTH,
Jonathan

Jonathan M.
Oxford, London, UK
http://www.jpluscplusm.com/contact.html