nginx 绑定80端口失败怎么解决?
1、使用systemctl status nginx.service -l 查看详情
部分详情:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
Aug 06 14:08:30 jumpserver systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 06 14:08:30 jumpserver systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
2、从错误中可以看出失败的原因是80端口被占用,所以造成nginx http和反向代理服务没法重启
先使用,ps- ef |grep 80
3、然后找到端口号,使有kill命令杀死进程。
kill -p
重启依然,报出错
4、最后使用fuser命令:
sudo fuser -k 80/tcp
5、因为80端口是专用端口,需要使用sudo命令
fuser命令 识别正在对某个文件或端口访问的进程
-k参数:杀掉访问文件的进程。
6、重启nginx
service nginx reload
nginx http和反向代理服务已经可以正常重启了。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。