nginx: [emerg] bind() to 0.0.0.0:80 失败(98:地址已经在使用)即使在使用端口 80 杀死进程之后

Kur*_*eek 2 linux nginx

我正在尝试按如下方式启动 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()
Run Code Online (Sandbox Code Playgroud)

按照这个EasyEngine 教程,我尝试使用端口 80终止进程fuser -k

kurt@kurt-ThinkPad:~$ sudo fuser -k 80/tcp
80/tcp:              31924 31925 31926
Run Code Online (Sandbox Code Playgroud)

但是,重新运行后,sudo /usr/sbin/nginx我得到完全相同的错误消息。

我试图描述的几个其他的“诊断”的位置,使用fuserlsof -i以及netstat

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      -      
Run Code Online (Sandbox Code Playgroud)

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

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

raj*_*cis 7

你应该运行这个

user@user ~ $ sudo netstat -tulpn | grep --color :80
Run Code Online (Sandbox Code Playgroud)

它会告诉你进程ID

tcp6       0      0 :::80                   :::*                    LISTEN      2063/apache2
Run Code Online (Sandbox Code Playgroud)

2063/apache2 - PID/进程名称