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

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

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

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

issued a nginx -s stop and after that I got this error when trying to reload it.
[error]: invalid PID number “” in “/var/run/nginx.pid”
That /var/run/nginx/pid file is empty atm.
What do I need to do to fix it?
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

$ sudo /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8090 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:2021 failed (98: Address already in use)
nginx: [emerg] still could not bind()
$ sudo /usr/sbin/nginx -s reload
$ ps -ef | grep nginx
root     23072     1  0 14:47 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
root     24923 23072  0 14:50 ?        00:00:00 nginx: worker process                   
root     24924 23072  0 14:50 ?        00:00:00 nginx: worker process                   
root     24925 23072  0 14:50 ?        00:00:00 nginx: worker process                   
root     24926 23072  0 14:50 ?        00:00:00 nginx: worker process                   
root     24927 23072  0 14:50 ?        00:00:00 nginx: worker process                   
root     24928 23072  0 14:50 ?        00:00:00 nginx: worker process                   
606      25538  4063  0 14:50 pts/8    00:00:00 grep nginx

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值