无法启动nginx

时间:2018-09-10 09:52:06

标签: nginx rtmp live-streaming systemctl

我在机器上安装了nginx,并且安装正确,但是无法在机器上启动nginx,每当我尝试启动nginx时,都会显示以下错误。 每当我运行命令systemctl restart nginx && systemctl status 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 - The NGINX HTTP and reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor 
   preset: e Active: failed (Result: exit-code) since Mon 2018-09-10 
  14:57:14 IST;32s ago Process: 6321 ExecStartPre=/usr/sbin/nginx -t 
  (code=exited ,status=203/EXEC)`

`Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: Starting The NGINX HTT
Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: nginx.service: Control
Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: Failed to start The NG
Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: nginx.service: Unit en
Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: nginx.service: Failed`

执行命令后: journalctl -xe,生成的输出为:

 `-- Unit nginx.service has begun starting up.
   Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC 
   systemd[6321]:nginx.service: Fail
   -- Subject: Process /usr/sbin/nginx could not be executed
   -- Defined-By: systemd
   -- Support: http://www.ubuntu.com/support
   -- 
   -- The process /usr/sbin/nginx could not be executed and failed.
   -- 
   -- The error number returned by this process is 2.
   Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: 
   nginx.service: 
   Control
   Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: Failed to 
   start The NG
   -- Subject: Unit nginx.service has failed
   -- Defined-By: systemd
   -- Support: http://www.ubuntu.com/support
   -- 
   -- Unit nginx.service has failed.
   -- 
   -- The result is failed.
   Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]: nginx.service: Unit en
   Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC systemd[1]:nginx.service: Failed 
   Sep 10 14:57:14 hk-HP-Pavilion-15-Notebook-PC polkitd(authority=local) [751]: Unr
   Sep 10 14:57:46 hk-HP-Pavilion-15-Notebook-PC systemd[1] Configuration file /li
   Sep 10 14:57:46 hk-HP-Pavilion-15-Notebook-PC systemd[1]:Configuration file /li`

为此寻找解决方案,但没有找到任何解决方案。任何帮助将不胜感激。

错误日志:         2018/09/10 15:50:47 [emerg] 7972#7972: bind() to 0.0.0.0:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to [::]:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to 0.0.0.0:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to [::]:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to 0.0.0.0:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to [::]:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to 0.0.0.0:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to [::]:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to 0.0.0.0:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: bind() to [::]:80 failed (98: Address already in use) 2018/09/10 15:50:47 [emerg] 7972#7972: still could not bind()

1 个答案:

答案 0 :(得分:1)

就像最后一个错误说您正在使用端口80一样,请检查端口80上是否有Apache

有用的命令:

  

netstat -tlpn