解决nginx无法启动的问题——端口被占用

6 篇文章 0 订阅

一段时间没使用nginx后,发现无法启动

问题:

输入nginx -tc /etc/nginx/nginx.conf 显示正常
但是输入 systemctl reload nginx 提示

Job for nginx.service invalid.
查错:

输入 systemctl status nginx.service -l
提示

● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2018-10-01 20:04:22 CST; 38s ago
     Docs: http://nginx.org/en/docs/
  Process: 27162 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

Oct 01 20:04:19 VM_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Oct 01 20:04:20 VM_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Oct 01 20:04:20 VM_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Oct 01 20:04:21 VM_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Oct 01 20:04:21 VM_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Oct 01 20:04:22 VM_205_38_centos nginx[27162]: nginx: [emerg] still could not bind()
Oct 01 20:04:22 VM_205_38_centos systemd[1]: nginx.service: control process exited, code=exited status=1
Oct 01 20:04:22 VM_205_38_centos systemd[1]: Failed to start nginx - high performance web server.
Oct 01 20:04:22 VM_205_38_centos systemd[1]: Unit nginx.service entered failed state.
Oct 01 20:04:22 VM_205_38_centos systemd[1]: nginx.service failed.
解决
vim /etc/nginx/conf.d/default.conf 

更改listen的端口,因为原来的端口被占用( Address already in use)

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值