多语言展示
当前在线:1207今日阅读:27今日分享:41

nginx 绑定80端口失败怎么解决?

在centos 7上做反向代理,修改conf文件后,重启nginx服务,报Job for nginx.service failed because the control process exited with error code. See 'systemctl status nginx.service' and 'journalctl -xe' for details,经查阅并实验,得以解决,现在解决方案送上,供大家参考。
工具/原料

linux

方法/步骤
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=1Aug 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 reloadnginx http和反向代理服务已经可以正常重启了。

注意事项

nginx

推荐信息