如何解决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] 10859#0: still could not bind()
[emerg] 10869#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg] 10869#0: bind() to 0.0.0.0:80 failed (98: Address already in use)

说明 80 端口占用

1、杀死所有名字为 nginx 进程

killall -9 nginx

2、启动 nginx 

 /usr/local/nginx/sbin/nginx

或者

1、 查看 80 端口被什么程序占用

lsof -i :80

2、 kill 掉所有的 nginx 进程

kill -9  pid

关于如何解决nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)报错就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。