nginx 启动服务异常,显示nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

重启服务器后可能会导致nginx启动异常,可能情况是因为端口占用了,解决方法就是查看端口情况,然后杀掉对应进程,重启nginx服务即可。

问题描述:

nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
......

解决:

lsof -i:80 #查询端口占用

kill -9 3305 #杀掉占用进程

server nginx start #启动nginx

#运行测试正常


评论/留言