什么(代码=已退出,状态=1 / 失败)?服务 nginx 状态

什么(代码=已退出,状态=1 / 失败)?服务 nginx 状态

我刚刚发现 nginx 状态有错误。这个错误不会阻止任何事情。它没有给我带来问题。一切都正确启动。Nginx -t 它没有返回任何语法错误。

我只在 nginx status 中看到它。服务 nginx status。或 Systemctl status 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: enabled)
   Active: active (running) since Sat 2017-02-11 20:55:04 UTC; 5min ago
  Process: 25343 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE)
  Process: 25710 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 25706 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 25715 (nginx)
    Tasks: 2
   Memory: 2.0M
      CPU: 49ms
   CGroup: /system.slice/nginx.service
           |-25715 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           `-25720 nginx: worker process                           

Feb 11 20:55:04 Singapore-ap-southeast systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 11 20:55:04 Singapore-ap-southeast systemd[1]: nginx.service: PID 25363 read from file /run/nginx.pid does not exist or is a zombie.
Feb 11 20:55:04 Singapore-ap-southeast systemd[1]: Started A high performance web server and a reverse proxy server.

發生錯誤。

我只是这样做了:

Service nginx stop

然后从新系统开始:

systemctl start nginx

现在他却吞噬了我。

    * nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-02-11 21:41:00 UTC; 1min 43s ago
  Process: 20928 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 20941 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 20938 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 20944 (nginx)
    Tasks: 2
   Memory: 2.0M
      CPU: 22ms
   CGroup: /system.slice/nginx.service
           |-20944 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           `-20945 nginx: worker process                           

Feb 11 21:41:00 Singapore-ap-southeast systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 11 21:41:00 Singapore-ap-southeast systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Feb 11 21:41:00 Singapore-ap-southeast systemd[1]: Started A high performance web server and a reverse proxy server.

我看到的唯一不好的事情是

PID from file /run/nginx.pid: Invalid argument

但全部功能齐全。

答案1

Process: 25343 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE)

这一行表示退出过程失败。(参见--stop其中的选项)。

这仅仅意味着它无法停止,这很可能意味着它根本没有运行:)

您真正需要担心的唯一事情是,当您尝试启动该服务时却发现它没有运行。

相关内容