nginx Job for nginx.service failed because the control process exited with error code. See "systemct

在centos7刚安装nginx 后启动报错:
[root@localhost html]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
[root@localhost html]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2019-04-09 21:00:29 CST; 4min 48s ago
Process: 68521 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 68518 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 68516 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Apr 09 21:00:28 localhost nginx[68521]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Apr 09 21:00:28 localhost nginx[68521]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Apr 09 21:00:28 localhost nginx[68521]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Apr 09 21:00:29 localhost nginx[68521]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Apr 09 21:00:29 localhost nginx[68521]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Apr 09 21:00:29 localhost nginx[68521]: nginx: [emerg] still could not bind()
Apr 09 21:00:29 localhost systemd[1]: nginx.service: control process exited, code=exited status=1
Apr 09 21:00:29 localhost systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Apr 09 21:00:29 localhost systemd[1]: Unit nginx.service entered failed state.
Apr 09 21:00:29 localhost systemd[1]: nginx.service failed.

ss -antp 显示:

State       Recv-Q Send-Q               Local Address:Port                              Peer Address:Port              
LISTEN      0      128                      127.0.0.1:9000                                         *:*                   users:(("php-fpm",pid=44167,fd=0),("php-fpm",pid=44166,fd=0),("php-fpm",pid=44165,fd=0),("php-fpm",pid=44164,fd=0),("php-fpm",pid=44163,fd=0),("php-fpm",pid=44162,fd=6))
LISTEN      0      128                              *:111                                          *:*                   users:(("rpcbind",pid=781,fd=8))
LISTEN      0      5                    192.168.122.1:53                                           *:*                   users:(("dnsmasq",pid=1467,fd=6))
LISTEN      0      128                              *:22                                           *:*                   users:(("sshd",pid=51519,fd=3))
LISTEN      0      128                      127.0.0.1:631                                          *:*                   users:(("cupsd",pid=1081,fd=12))
LISTEN      0      128                      127.0.0.1:6010                                         *:*                   users:(("sshd",pid=58561,fd=9))
LISTEN      0      128                      127.0.0.1:6011                                         *:*                   users:(("sshd",pid=64134,fd=9))
ESTAB       0      52                    10.0.112.237:22                                10.0.112.250:49778               users:(("sshd",pid=58561,fd=3))
ESTAB       0      0                     10.0.112.237:22                                10.0.112.250:57851               users:(("sshd",pid=64134,fd=3))
LISTEN      0      80                              :::3306                                        :::*                   users:(("mysqld",pid=42610,fd=25))
LISTEN      0      128                             :::111                                         :::*                   users:(("rpcbind",pid=781,fd=11))
LISTEN      0      128                             :::80                                          :::*                   users:(("httpd",pid=44221,fd=4),("httpd",pid=44220,fd=4),("httpd",pid=44219,fd=4),("httpd",pid=44218,fd=4),("httpd",pid=44217,fd=4),("httpd",pid=44216,fd=4),("httpd",pid=41364,fd=4),("httpd",pid=41363,fd=4),("httpd",pid=41362,fd=4),("httpd",pid=41361,fd=4),("httpd",pid=41360,fd=4))
LISTEN      0      32                              :::21                                          :::*                   users:(("vsftpd",pid=5154,fd=4))
LISTEN      0      128                             :::22                                          :::*                   users:(("sshd",pid=51519,fd=4))
LISTEN      0      128                            ::1:631                                         :::*                   users:(("cupsd",pid=1081,fd=11))
LISTEN      0      128                            ::1:6010                                        :::*                   users:(("sshd",pid=58561,fd=8))
LISTEN      0      128                            ::1:6011                                        :::*                   users:(("sshd",pid=64134,fd=8))

最后killall httpd 就好了

[root@localhost html]# killall httpd
[root@localhost html]# systemctl restart nginx
[root@localhost html]# systemctl status nginx
```
[root@localhost html]# systemctl restart nginx
[root@localhost html]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-04-09 21:07:44 CST; 15s ago
  Process: 68631 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 68629 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 68627 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 68634 (nginx)
    Tasks: 3
   CGroup: /system.slice/nginx.service
           ├─68634 nginx: master process /usr/sbin/nginx
           ├─68635 nginx: worker process
           └─68636 nginx: worker process

Apr 09 21:07:44 localhost systemd[1]: Starting The nginx HTTP and reverse proxy server...
Apr 09 21:07:44 localhost nginx[68629]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Apr 09 21:07:44 localhost nginx[68629]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Apr 09 21:07:44 localhost systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
Apr 09 21:07:44 localhost systemd[1]: Started The nginx HTTP and reverse proxy server.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值