nginx [error] open() "/usr/local/nginx/logs/nginx.pid" failed

本文介绍了一种常见的Nginx配置问题——Nginx.pid文件缺失,并提供了详细的解决方案。通过重新启动Nginx服务并指定正确的配置文件路径,最终成功创建了Nginx.pid文件。

[root@localhost sbin]# ./nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

进到logs文件发现的确没有nginx.pid文件

解决方法:

[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
使用nginx -c的参数指定nginx.conf文件的位置
[root@localhost nginx]# cd logs/
[root@localhost logs]# ls -al
总用量 12
-rw-r--r-- 1 root root 1246 129 18:10 access.log
-rw-r--r-- 1 root root 516 1210 15:39 error.log
-rw-r--r-- 1 root root 5 1210 15:38 nginx.pid
看nginx.pid文件已经有了。
reading config file /etc/logrotate.d/nginx reading config info for /usr/local/nginx/logs/*log Handling 1 logs rotating pattern: /usr/local/nginx/logs/*log forced from command line (10 rotations) empty log files are not rotated, old logs are removed considering log /usr/local/nginx/logs/access.log log does not need rotating considering log /usr/local/nginx/logs/error.log log needs rotating rotating log /usr/local/nginx/logs/error.log, log->rotateCount is 10 dateext suffix '-20251111' glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' renaming /usr/local/nginx/logs/error.log.10.gz to /usr/local/nginx/logs/error.log.11.gz (rotatecount 10, logstart 1, i 10), renaming /usr/local/nginx/logs/error.log.9.gz to /usr/local/nginx/logs/error.log.10.gz (rotatecount 10, logstart 1, i 9), renaming /usr/local/nginx/logs/error.log.8.gz to /usr/local/nginx/logs/error.log.9.gz (rotatecount 10, logstart 1, i 8), renaming /usr/local/nginx/logs/error.log.7.gz to /usr/local/nginx/logs/error.log.8.gz (rotatecount 10, logstart 1, i 7), renaming /usr/local/nginx/logs/error.log.6.gz to /usr/local/nginx/logs/error.log.7.gz (rotatecount 10, logstart 1, i 6), renaming /usr/local/nginx/logs/error.log.5.gz to /usr/local/nginx/logs/error.log.6.gz (rotatecount 10, logstart 1, i 5), renaming /usr/local/nginx/logs/error.log.4.gz to /usr/local/nginx/logs/error.log.5.gz (rotatecount 10, logstart 1, i 4), renaming /usr/local/nginx/logs/error.log.3.gz to /usr/local/nginx/logs/error.log.4.gz (rotatecount 10, logstart 1, i 3), renaming /usr/local/nginx/logs/error.log.2.gz to /usr/local/nginx/logs/error.log.3.gz (rotatecount 10, logstart 1, i 2), renaming /usr/local/nginx/logs/error.log.1.gz to /usr/local/nginx/logs/error.log.2.gz (rotatecount 10, logstart 1, i 1), renaming /usr/local/nginx/logs/error.log.0.gz to /usr/local/nginx/logs/error.log.1.gz (rotatecount 10, logstart 1, i 0), renaming /usr/local/nginx/logs/error.log to /usr/local/nginx/logs/error.log.1 creating new /usr/local/nginx/logs/error.log mode = 0644 uid = 496 gid = 493 running postrotate script running script with arg /usr/local/nginx/logs/*log : " /bin/kill -USR1 $(cat /usr/local/nginx/nginx.pid) " compressing log with: /bin/gzip removing old log /usr/local/nginx/logs/error.log.11.gz error: error opening /usr/local/nginx/logs/error.log.11.gz: 没有那个文件或目录这是执行的结果
最新发布
11-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值