红联Linux门户
Linux帮助

Nginx启动时出现Address already in use解决方案

发布时间:2017-06-26 10:04:01来源:linux网站作者:拂去烟尘
启动Ngnix的时候提示错误,异常信息如下:
[root@centos-512mb-sfo2-01 nginx-1.10.3]# /opt/nginx-1.10.3/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()
 
问题描述:端口已被使用,导致端口占用,出现此错误。
 
解决方案:
1.查看当前端口的使用情况
原因: 端口 80 端口被占用,用 “lsof -i:80” 命令查看一下是什么程序占用了80端口,我的结果显示是 80 端口被 Apache 占用
Nginx启动时出现Address already in use解决方案
既然被占用,就将占用的进程关闭即可.像上面的问题我们可以采用:
service httpd stop
关闭Apache进程即可.
同理,要是在安装了nginx的服务器要想启动Apache,关闭nginx进程即可.
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31725.html