当前位置: 首页 >服务端 > 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)

1、systemctl start nginx 启动 NGINX 报错 , 使用 systemctl status nginx 看信息
[root@localhost /]# systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "joualctl -xe" for details.
[root@localhost /]# systemctl status nginx
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-06-30 18:32:55 CST; 7s ago
Process: 8109 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 8107 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 8105 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 1750 (code=killed, signal=KILL)
Memory: 11.2M
CGroup: /system.slice/nginx.service
├─1751 nginx: worker process
├─1752 nginx: worker process
├─1753 nginx: worker process
├─1754 nginx: worker process
├─1755 nginx: worker process
├─1756 nginx: worker process
├─1757 nginx: worker process
└─1758 nginx: worker process

Jun 30 18:32:54 localhost.localdomain nginx[8109]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Jun 30 18:32:54 localhost.localdomain nginx[8109]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jun 30 18:32:54 localhost.localdomain nginx[8109]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jun 30 18:32:54 localhost.localdomain nginx[8109]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Jun 30 18:32:54 localhost.localdomain nginx[8109]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jun 30 18:32:55 localhost.localdomain nginx[8109]: nginx: [emerg] still could not bind()
Jun 30 18:32:55 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Jun 30 18:32:55 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jun 30 18:32:55 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Jun 30 18:32:55 localhost.localdomain systemd[1]: nginx.service failed.

地址被占用,可能nginx服务卡死了,导致端口占用,出现此错误

2、使用: **lsof -i:80 ** 查看哪个程序在使用 80 端口

[root@localhost /]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 1751 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1751 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1752 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1752 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1753 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1753 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1754 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1754 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1755 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1755 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1756 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1756 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1757 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1757 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)
nginx 1758 root 8u IPv4 29257 0t0 TCP *:http (LISTEN)
nginx 1758 root 10u IPv6 29259 0t0 TCP *:http (LISTEN)

是 NGINX 自己占用,使用 kill -9 pid 杀死已运行的NGINX
kill -9 1751
.....

3、使用 systemctl start nginx 重启 NGINX 服务

结束

作者:zhanglw
来源链接:https://www.cnblogs.com/zhanglw456/p/13217494.html

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaclub.cn/server/113163.html

标签:Nginx
分享给朋友:

“NGINX 启动失效 [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)” 的相关文章

[C++]VC自定义发IP包例子 2022年05月17日 20:41:27
[C#][控件]常用控件命名规范 2022年05月17日 20:45:24
MySQL安装之yum安装 2022年05月19日 19:54:29
常用日志框架介绍 2022年05月19日 20:04:06
Java日志框架那些事儿 2022年05月19日 20:04:37
Python 散列表查询 2022年05月20日 21:28:09
go mod 相关的八个命令 2022年05月23日 20:17:45