nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"

[root@data01 sbin]# ./nginx -s reload
nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"

查看nginx.pid为空

[root@data01 sbin]# cat /usr/local/nginx/logs/nginx.pid

解决:

查看nginx运行的PID,然后加入到nginx.pid文件中

root@data01 sbin]# ps -ef |grep nginx
root       6015      1  0 Jan17 ?        00:00:00 nginx: master process ./sbin/nginx
root      50668   6015  0 Feb01 ?        04:33:36 nginx: worker process
root      50669   6015  0 Feb01 ?        04:42:32 nginx: worker process
root      50670   6015  0 Feb01 ?        04:41:05 nginx: worker process
root      50671   6015  0 Feb01 ?        04:32:57 nginx: worker process
root      50672   6015  0 Feb01 ?        04:36:38 nginx: worker process
root      50673   6015  0 Feb01 ?        04:35:04 nginx: worker process
root      50674   6015  0 Feb01 ?        04:33:01 nginx: worker process
root      50675   6015  0 Feb01 ?        04:43:13 nginx: worker process
root      50676   6015  0 Feb01 ?        04:33:02 nginx: worker process
root      50677   6015  0 Feb01 ?        04:32:44 nginx: worker process
root      50678   6015  0 Feb01 ?        04:40:56 nginx: worker process
root      50679   6015  0 Feb01 ?        04:33:26 nginx: worker process
root      50680   6015  0 Feb01 ?        04:40:43 nginx: worker process
root      50681   6015  0 Feb01 ?        04:31:06 nginx: worker process
root      50682   6015  0 Feb01 ?        04:36:44 nginx: worker process
root      50683   6015  0 Feb01 ?        04:32:21 nginx: worker process
root      50684   6015  0 Feb01 ?        04:39:34 nginx: worker process
root      50685   6015  0 Feb01 ?        04:31:09 nginx: worker process
root      50686   6015  0 Feb01 ?        04:39:19 nginx: worker process
root      50687   6015  0 Feb01 ?        04:29:11 nginx: worker process
[root@data01 sbin]# echo 6015 > /usr/local/nginx/logs/nginx.pid
[root@data01 sbin]# ./nginx -s reload
原文地址:https://www.cnblogs.com/xiaoyou2018/p/10762203.html