欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

nginx报错:nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log“ failed (2: N

发布时间:2025/3/20 编程问答 41 豆豆
生活随笔 收集整理的这篇文章主要介绍了 nginx报错:nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log“ failed (2: N 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

参考文章1:nginx error_log 错误日志配置说明

如图,启动nginx时报错:

[root@RV1126_RV1109:/usr/sbin]# nginx -c /etc/nginx/nginx.conf nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory) 2021/10/19 15:42:22 [emerg] 2434#0: mkdir() "/var/tmp/nginx/client-body" failed (2: No such file or directory)

我直接把缺少的文件手动创建了,。。

mkdir xxxx/xxxx/xxx… -p 之类的

touch xxx

reboot后又没了。。。。

看这篇文章说用-t命令能测试nginx,果然,又多输出了一个错误:

[root@RV1126_RV1109:/usr/sbin]# nginx -t nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory) nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 2021/10/19 15:49:35 [emerg] 2781#0: mkdir() "/var/tmp/nginx/client-body" failed (2: No such file or directory) nginx: configuration file /etc/nginx/nginx.conf test failed [root@RV1126_RV1109:/usr/sbin]#

看这篇文章说,只有root用户才能使用1024以下的端口,但是我已经是root用户了呀,怎么还是提示我没权限呢?是不是我要把端口80改成1024以上?

20211022

DS的人说,你先killall webs(不要注释/opt/init/run.sh里的deamon),然后再运行/etc/init.d/dS50nginx restart就可以了,

总结

以上是生活随笔为你收集整理的nginx报错:nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log“ failed (2: N的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。