码迷,mamicode.com
首页 > 其他好文 > 详细

nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument解决

时间:2019-05-02 15:39:42      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:RoCE   usr   emctl   rman   dap   fail   target   exp   roc   

先附上错误信息:

 1 (myblog) root@Dapeng:/home/uwsgi# service nginx status 
 2 ● nginx.service - A high performance web server and a reverse proxy server
 3    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
 4    Active: active (running) since Thu 2019-05-02 13:49:36 CST; 29s ago
 5   Process: 17090 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
 6   Process: 17101 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 7   Process: 17094 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 8  Main PID: 17103 (nginx)
 9     Tasks: 2
10    Memory: 1.8M
11       CPU: 35ms
12    CGroup: /system.slice/nginx.service
13            ├─17103 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
14            └─17104 nginx: worker process                           
15 
16 May 02 13:49:36 Dapeng systemd[1]: Stopped A high performance web server and a reverse proxy server.
17 May 02 13:49:36 Dapeng systemd[1]: Starting A high performance web server and a reverse proxy server...
18 May 02 13:49:36 Dapeng systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
19 May 02 13:49:36 Dapeng systemd[1]: Started A high performance web server and a reverse proxy server.

我的操作系统是ubuntu16.04,今天突然重启nginx后,发现给我报了一个502的错误,看了一下nginx的状态,里面有一个错误提示,就如同标题那样,遂Google,在一个歪果仁的个人博客中看到一个链接,解决了我的问题,我这里只做一个搬运工,有问题的小伙伴也可以参考。再附上ubuntu社区参考链接:bug for ubuntu

这个问题被当做bug来解决了,不过好在有大神解决,附上解决思路:

1 It seems to be a race between systemd and nginx. As if systemd was expecting the PID file to be populated before nginx had the time to create it.
2 
3 Workaround:
4 
5  mkdir /etc/systemd/system/nginx.service.d
6  printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
7  systemctl daemon-reload

然后我们再重启一下就好了。

 

nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument解决

标签:RoCE   usr   emctl   rman   dap   fail   target   exp   roc   

原文地址:https://www.cnblogs.com/cpl9412290130/p/10802434.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!