linux - nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 即使在使用端口 80 终止进程之后

标签 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()

关注此EasyEngine tutorial ,我试图通过 fuser -k 终止使用端口 80 的进程:

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

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

我已经尝试了描述的其他几个“诊断”here ,使用 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 工作的任何想法?

最佳答案

你应该运行这个

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

它会显示你的进程号

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

2063/apache2 – PID/进程名称

关于linux - nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 即使在使用端口 80 终止进程之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41300133/

相关文章:

php - 使用 PHP 系统和 cURL 时出现权限问题?

linux - 合并两个文件,将 file1 中的一个字段替换为 file2 中的另一个字段

ruby - 在服务器上运行脚本的最佳方式(甚至是 cron)但很容易公开日志

ssl - 一个域上有多个 SSL 证书

nginx - 在 Dokku 上的 nginx.conf 中禁用 HTTPS 重定向

linux - 无法获得这个简单的 sed 命令

linux - 何时在 K8s 中使用外部 LoadBalancer?

c# - 关于使用 Nginx 将 Web 请求代理到基于 .Net HttpListener 的 Json 服务的想法

css - 如何在 Windows 上将 docker nginx 与 express 和 react 应用程序连接起来

ruby-on-rails - 调试 502 Bad Gateway 错误 - Ubuntu、Nginx、Unicorn