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

Dear 丶 2024-04-18 18:23 171阅读 0赞

部署flask项目,添加配置文件后,想重启一下nginx,结果报错:

  1. $ sudo nginx -s reload
  2. nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"

原因分析:
nginx.pid丢掉了
解决:

  1. issued a nginx -s stop and after that I got this error when trying to reload it.
  2. [error]: invalid PID number “” in “/var/run/nginx.pid
  3. That /var/run/nginx/pid file is empty atm.
  4. What do I need to do to fix it?
  5. nginx -s reload is only used to tell a running nginx process to reload its config. After a stop, you don't have a running nginx process to send a signal to. Just run nginx (possibly with a -c /path/to/config/file)

运行命令,问题得以解决:

sudo /usr/sbin/nginx -c /etc/nginx/nginx.conf

  1. $ sudo /usr/sbin/nginx -c /etc/nginx/nginx.conf
  2. nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
  3. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  4. nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
  5. nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
  6. nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
  7. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  8. nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
  9. nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
  10. nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
  11. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  12. nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
  13. nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
  14. nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
  15. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  16. nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
  17. nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
  18. nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
  19. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  20. nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
  21. nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
  22. nginx: [emerg] still could not bind()
  23. $ sudo /usr/sbin/nginx -s reload
  24. $ ps -ef | grep nginx
  25. root 23072 1 0 14:47 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
  26. root 24923 23072 0 14:50 ? 00:00:00 nginx: worker process
  27. root 24924 23072 0 14:50 ? 00:00:00 nginx: worker process
  28. root 24925 23072 0 14:50 ? 00:00:00 nginx: worker process
  29. root 24926 23072 0 14:50 ? 00:00:00 nginx: worker process
  30. root 24927 23072 0 14:50 ? 00:00:00 nginx: worker process
  31. root 24928 23072 0 14:50 ? 00:00:00 nginx: worker process
  32. 606 25538 4063 0 14:50 pts/8 00:00:00 grep nginx

参考:https://www.jb51.net/article/45658.htm

发表评论

表情:
评论列表 (有 0 条评论,171人围观)

还没有评论,来说两句吧...

相关阅读