How to turn off or specify the nginx error log location?

后端 未结 6 1373
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-01 11:09

I compiled the nginx on Ubuntu myself. I start my nginx with -c nginx.conf parameter. In my nginx.conf file, I try to turn off error log with but failed.

err         


        
6条回答
  •  情深已故
    2021-01-01 11:48

    You can't solve the problem by specifying a -p prefix; because that would only apply to the directives in the configuration file; and as RickyA already noted the problem is that there is a compiled-in error log that nginx wants to open even before it opens the configuration. Changing permissions of the compiled-in error log is not ideal, for obvious reasons.

    A workaround is to specify the error log as a configuration on the command line:

    $ nginx -p . -g 'error_log error.log;'
    

    or

    $ nginx -p . -g 'error_log stderr;'
    

    You'll still get an [alert] but at least it allowed me to start nginx as non-root on Ubuntu.

提交回复
热议问题