nginx报错:nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log“ failed (2: N
Posted Dontla
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的主要内容,如果未能解决你的问题,请参考以下文章
nginx [alert] 12339#0: 1024 worker_connections are not enough
nginx异常 [alert] 940#940: 768 worker_connections are not enough 解决
nginx [alert] 12339#0: 1024 worker_connections are not enough