【问题标题】:not able to start nginx无法启动 nginx
【发布时间】:2018-09-10 09:52:05
【问题描述】:

我在我的机器上安装了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()

【问题讨论】:

  • 是否有nginx 错误日志?
  • 在上面发布了错误。

标签: nginx rtmp live-streaming systemctl


【解决方案1】:

就像最后一个错误说你正在使用端口 80,检查端口 80 上是否有 apache

有用的命令:

netstat -tlpn

【讨论】:

  • 是的,端口正在使用中。现在我在端口:80 处终止了进程并执行命令systemctl restart nginx && systemctl status nginx,它显示:nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en Active: active (running) since Mon 2018-09-10 16:03:16 IST; 16ms ago Docs: man:nginx(8) Process: 8903 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code Process: 8902 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process .....
  • 谢谢!有效。我被困在这一点上,无法想到这一点。
猜你喜欢
  • 1970-01-01
  • 2018-05-16
  • 2018-08-30
  • 2017-03-22
  • 2022-01-22
  • 2018-04-20
  • 2017-01-16
  • 1970-01-01
  • 2022-10-22
相关资源
最近更新 更多