记一次Nginx启动失败解决过程(环境:linux Ubuntu 16.04 64bit , ECS for Aliyun)

背景:今天装了个jpress想弄个博客,然后关了Nginx和uwsgi,启动了tomcat(使用80端口),后来直接shutdown.sh关闭tomcat后,再次启动Nginx报了个错误:

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

 

然后使用命令systemctl status nginx.service查看报错详情,输出的是:

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2019-03-03 19:17:00 CST; 9s ago
     Docs: man:nginx(8)
  Process: 24254 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE)
  Process: 24838 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 24835 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 15307 (code=killed, signal=KILL)

Mar 03 19:16:58 iZbp1a5bxfhn1xwt8y1yzdZ nginx[24838]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 03 19:16:58 iZbp1a5bxfhn1xwt8y1yzdZ nginx[24838]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 03 19:16:59 iZbp1a5bxfhn1xwt8y1yzdZ nginx[24838]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 03 19:16:59 iZbp1a5bxfhn1xwt8y1yzdZ nginx[24838]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 03 19:17:00 iZbp1a5bxfhn1xwt8y1yzdZ nginx[24838]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 03 19:17:00 iZbp1a5bxfhn1xwt8y1yzdZ nginx[24838]: nginx: [emerg] still could not bind()
Mar 03 19:17:00 iZbp1a5bxfhn1xwt8y1yzdZ systemd[1]: nginx.service: Control process exited, code=exited status=1
Mar 03 19:17:00 iZbp1a5bxfhn1xwt8y1yzdZ systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Mar 03 19:17:00 iZbp1a5bxfhn1xwt8y1yzdZ systemd[1]: nginx.service: Unit entered failed state.
Mar 03 19:17:00 iZbp1a5bxfhn1xwt8y1yzdZ systemd[1]: nginx.service: Failed with result 'exit-code'.

没看出什么特别有价值的信息,根据丰富的踩坑经验,猜测应该是端口有冲突,使用以下命令查看端口使用详情:

netstat -tnlp

显示如下:

果然是被java占用了,然后使用命令:kill -9 PID关掉占用线程(我这里是kill -9 24531)即可,就可以启动Nginx啦~

 

如果我的文章对您有帮助,就请客官给个赞吧

THE END!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值