先附上错误信息:

 (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

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

nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument解决的更多相关文章

  1. centos7 nginx Failed to read PID from file /run/nginx.pid: Invalid argument 解决方法

    笔者在centos7上,配置nginx代理服务后, systemctl status nginx.service 提示错误 Failed to read PID from file /run/ngin ...

  2. Nginx启动错误 Failed to read PID from file /run/nginx.pid 的处理方法

    问题产生原因 因为 nginx 启动需要一点点时间,而 systemd 在 nginx 完成启动前就去读取 pid file 造成读取 pid 失败 解决方法 让 systemd 在执行 ExecSt ...

  3. Failed to issue method call: Unit mysql.service failed to load: No such file or directory解决的方式

    Failed to issue method call: Unit mysql.service failed to load: No such file or directory解决的方式 作者:ch ...

  4. Failed to issue method call: Unit httpd.service failed to load: No such file or directory.

    centos7修改httpd.service后运行systemctl restart httpd.service提示 Failed to issue method call: Unit httpd.s ...

  5. nginx提示Job for nginx.service failed because the control的问题

    启动nginx时就报错!Job for nginx.service failed because the control process exited with error code. See &qu ...

  6. 解决CentOS7关闭/开启防火墙出现Unit iptables.service failed to load: No such file or directory.

    CentOS7中执行 service iptables start/stop 会报错Failed to start iptables.service: Unit iptables.service fa ...

  7. nginx进行项目域名配置时提示Job for nginx.service failed

    ps aux | grep nginx /bin/systemctl stop nginx.service /bin/systemctl start nginx.service /bin/system ...

  8. CentOS 7.x关闭/开启防火墙出现Unit iptables.service failed to load: No such file or directory问题解决

    一直用CentOS 6.x,今天用CentOS7.3版本时,防火墙配置后执行service iptables start出现”Failed to restart iptables.service: U ...

  9. centos7 ngxin启动失败:Job for nginx.service failed(80端口被占用的解决办法)

    问题描述:(flaskApi) [root@67 flaskDemo]# service nginx start Redirecting to /bin/systemctl start nginx.s ...

随机推荐

  1. python模块之datetime方法详细介绍

    datetime Python提供了许多内置模块用于操作时间日期,如calendar,time,datetime,这篇文章主要是对datetime进行汇总,datetime模块的借口实现原则更加直观, ...

  2. postgis 赋予postgresql空间数据库的能力

    安装: Windows:postgresql的bin目录下:运行stackbuilder,一步一步按照提示来就行了 Ubuntu: apt-get install postgresql-9.3-pos ...

  3. gogs迁移

    windows->linux 之前gogs放在windows server2016中,需要迁移至linux docker中. 首先拉取gogs镜像 docker pull gogs/gogs 然 ...

  4. malloc内存申请--释放-收缩

     一.验证思路和代码 #include <stdio.h> #include <unistd.h> #include <malloc.h> #include < ...

  5. hadoop map 个数 源码分析

    本文转自http://ronxin999.blog.163.com/blog/static/42217920201279112163/

  6. 四,JVM 自带命令行工具之JStack

    jstack(stack trace for java) 命令 用于查看虚拟机当前时刻的线程快照(一般称为threaddump或者javacore文件).线程快照就是当前虚拟机内每一条线程正在执行的方 ...

  7. Python3基础(5)常用模块:time、datetime、random、os、sys、shutil、shelve、xml处理、ConfigParser、hashlib、re

    ---------------个人学习笔记--------------- ----------------本文作者吴疆-------------- ------点击此处链接至博客园原文------ 1 ...

  8. 二维数组的转置(java)

    public class ShuZhuDaoZhi { public static void main(String[] args) { int data[][] = new int[][]{{1, ...

  9. linux修改系统时间为北京时间(CentOS)

    删除本地时间 rm -rf /etc/localtime 设置时区为上海 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 利用date查看 ...

  10. ArcMap中提取影像数据边界

    1.前言 客户手里有一些经过裁剪的不规则多边形影像数据(如图例所示),希望能批量获取该类影像的边界信息,即影像对应的面信息,边界线信息.这里我们提供一种利用镶嵌数据集Footprint图层的方法来获取 ...