nginx: [emerg]绑定到0.0.0.0:80失败(98:地址已被使用),即使杀死了使用端口80的进程。

6

我正在尝试如下启动nginx:

kurt@kurt-ThinkPad:~$ which nginx
/usr/sbin/nginx
kurt@kurt-ThinkPad:~$ sudo /usr/sbin/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()

按照EasyEngine教程的步骤,我尝试使用fuser -k命令杀掉80端口的进程:

kurt@kurt-ThinkPad:~$ sudo fuser -k 80/tcp
80/tcp:              31924 31925 31926

然而,重新运行sudo /usr/sbin/nginx后,我得到了完全相同的错误信息。

我尝试了一些其他在这里描述的“诊断”方法,使用fuserlsof -inetstat

kurt@kurt-ThinkPad:~$ fuser 80/tcp
kurt@kurt-ThinkPad:~$ lsof -i :80 | grep LISTEN
kurt@kurt-ThinkPad:~$ netstat -tulpn | grep --color :80
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      -      

只有netstat命令给出了结果,但我无法从中推断出进程ID。

有没有关于如何让nginx工作的想法?

1个回答

13

你应该运行这个

user@user ~ $ sudo netstat -tulpn | grep --color :80

它将会显示进程的标识号

tcp6       0      0 :::80                   :::*                    LISTEN      2063/apache2

2063/apache2 - PID/进程名称


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接