先附上错误信息:

 (myblog) root@Dapeng:/home/uwsgi# service nginx status
● 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 Thu -- :: CST; 29s ago
Process: ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/ --pidfile /run/nginx.pid (code=exited, status=/SUCCESS)
Process: ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=/SUCCESS)
Process: ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=/SUCCESS)
Main PID: (nginx)
Tasks:
Memory: 1.8M
CPU: 35ms
CGroup: /system.slice/nginx.service
├─ nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─ nginx: worker process May :: Dapeng systemd[]: Stopped A high performance web server and a reverse proxy server.
May :: Dapeng systemd[]: Starting A high performance web server and a reverse proxy server...
May :: Dapeng systemd[]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
May :: Dapeng systemd[]: Started A high performance web server and a reverse proxy server.

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

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

 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.

 Workaround:

  mkdir /etc/systemd/system/nginx.service.d
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
systemctl daemon-reload

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

最新文章

  1. [Gnu]Centos7 解决 gdb 提示 Missing separate debuginfos
  2. Sublime Text 3初阶
  3. 反射动态创建不同的Processor
  4. 【使用 DOM】使用 Document 对象
  5. js中使用s(c)标签
  6. SharePoint的实体生成
  7. Python中*和**的用法
  8. 单片微机原理P4:80C51串口与串行总线拓展
  9. MySql的like语句中的通配符:百分号、下划线和escape 的使用
  10. Python多线程2:sched
  11. javac不是内部命令和外部命令
  12. 你不知道的JavaScript--Item1 严格模式
  13. MIUI系统如何获取ROOT权限
  14. 线程中的队列(queue)
  15. Battery historian安装及使用
  16. (三)apache的安装与配置
  17. Windows Server 2008中使用计划任务定时执行BAT bat进行PHP脚本的执行
  18. 如何写一个好的缺陷(Defect)报告
  19. ERROR 2003:Can't connect to MySQL server on 'localhost'
  20. Knockout.Js官网学习(checked 绑定)

热门文章

  1. python_魔法方法(四):属性访问
  2. C# 枚举与switch用法
  3. jdbc 操作步骤详解
  4. Asp.NetCore 2.2 WebApi 发布到IIS步骤及错误处理
  5. opencv——IplImage结构
  6. C 碎片五 数组
  7. springBoot学习 错误记录
  8. 使用SpringSession管理分布式系统的会话Session
  9. Java算法面试题 一个顺子带一对
  10. 从零开始的全栈工程师——js篇2.17(属性和节点获取)