WDlinux官方论坛's Archiver

yux82 发表于 2015-4-21 09:21

解决错误 Stopping nginx: nginx: [error] invalid PID number

[i=s] 本帖最后由 yux82 于 2015-4-21 09:22 编辑 [/i]

前几天忘记什么原因kill 掉80端口nginx 导致出现这个错误,新建站点变成了 404 Not Found nginx/1.2.9  重启nginx后错误如下[code]Stopping nginx: nginx: [error] invalid PID number "" in "/www/wdlinux/nginx/logs/nginx.pid"
                                                           [  OK  ]
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 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:80 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:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
                                                           [FAILED][/code]查了点资料,有文章上说可能是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 初学的小菜鸟,以上方法有什么不对的地方请大家指正,谢谢

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.