如何关闭或指定Nginx错误日志位置? [英] How to turn off or specify the nginx error log location?

查看:1429
本文介绍了如何关闭或指定Nginx错误日志位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自己在Ubuntu上编译了nginx. 我使用-c nginx.conf参数启动我的nginx. 在我的nginx.conf文件中,我尝试使用关闭错误日志,但失败了.

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.

error_log /dev/null crit;

仍然收到错误消息: nginx:[警报]无法打开错误日志文件:open()"/usr/nginx/logs/error.log"失败(2:无此类文件或目录)

Still got the error message: nginx: [alert] could not open error log file: open() "/usr/nginx/logs/error.log" failed (2: No such file or directory)

如何关闭此日志或更改其位置?

How could I turn off this log or change its location?

推荐答案

禁用错误日志的语法还可以,但是文档指出在读取配置之前已使用默认日志文件. (这似乎很合理,因为否则会告诉您配置错误)

The syntax for disabling the error log is ok, but the docs state that a default logfile is used before the config is read. (which seems reasonable because how would it otherwise tell you you have an error in your config)

尝试使用运行nginx的用户的正确权限手动创建此文件.或者尝试以root用户身份启动服务器.

Try creating this file by hand with the correct permissions for the user that runs nginx. Or try starting the server as root.

这篇关于如何关闭或指定Nginx错误日志位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆