Board logo

标题: [分享] 解决错误 Stopping nginx: nginx: [error] invalid PID number [打印本页]

作者: yux82    时间: 2015-4-21 09:21     标题: 解决错误 Stopping nginx: nginx: [error] invalid PID number

本帖最后由 yux82 于 2015-4-21 09:22 编辑

前几天忘记什么原因kill 掉80端口nginx 导致出现这个错误,新建站点变成了 404 Not Found nginx/1.2.9  重启nginx后错误如下
  1. Stopping nginx: nginx: [error] invalid PID number "" in "/www/wdlinux/nginx/logs/nginx.pid"
  2.                                                            [  OK  ]
  3. Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  4. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  5. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  6. nginx: [emerg] bind() to 0.0.0.0:80 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] still could not bind()
  9.                                                            [FAILED]
复制代码
查了点资料,有文章上说可能是nginx.pid丢失了,于是 cat /www/wdlinux/nginx/logs/nginx.pid,发现是空的,无内容,其实nginx.pid 中的内容就是进程id

然后 netstat -ntpl

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3673/nginx

看到nginx 进程id 是3673

vi /www/wdlinux/nginx/logs/nginx.pid  编辑 3673 保存退出

重启 service nginxd restart 成功

本人也是个linux 初学的小菜鸟,以上方法有什么不对的地方请大家指正,谢谢




欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/) Powered by Discuz! 7.2