先附上错误信息:

 (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. Zabbix之CentOS7.3下yum安装Zabbix3.5

    Zabbix特点介绍 (此介绍来源于https://www.zabbix.com/documentation/3.4/zh/manual/introduction/features) 概述Zabbix ...

  2. t.call is not a function

    js 写错了... 代码: $("form").each({$(this).submit(function(){return false;})}); 丢了一个 function() ...

  3. Migration-添加表(加外键)

    public partial class _222 : DbMigration { public override void Up() { //DropForeignKey("dbo.Ass ...

  4. selenium框架安装及webdriver安装

    本文介绍的是selenium安装及webdriver安装.小实例 1.selenium介绍 selenium是一个用于web应用程序测试的工具. Selenium测试直接运行在浏览器,就向真正的用户操 ...

  5. windows7安装完上不了网

    安装完Windows7后发现上不了网,网卡驱动没有安装的原因:但是没有网怎么下载驱动呢,,先装一个网卡版驱动精灵(貌似叫驱动精灵万能网卡版)什么的安装一个网卡驱动,就解决了

  6. 如何设计企业移动应用 by宋凯

    移动应用设计内部培训 by宋凯 企业移动应用的特点:简约.效率.增强ERP与环境的结合.及时.安全.企业内社交. 一句话定义你的移动应用:然后围绕这句话来设计你的APP. 一:如何定义你的应用: 1, ...

  7. SpringBoot | 第一章:第一个SpringBoot应用

    springboot简单介绍 概述 SpringBoot的核心功能 优缺点 优点 缺点 工程搭建 创建项目 项目结构 pom依赖 主入口 编写controller 启动应用 总结 老生常谈 sprin ...

  8. InteliJ idea import project 找不到文件结构解决办法

    一.按下列步骤操作:       1. 关闭IDEA,        2.然后删除项目文件夹下的.idea文件夹       3.重新用IDEA工具打开项目: 二.import新项目之后,可能需要等1 ...

  9. .net core mvc项目部署nginx报错一直显示404错误

    遇到一个奇怪的问题,.net core mvc 项目部署到nginx上面,系统是linux,controller明明抛出500错误,但页面一直显示是404. 解决如下: 1.修改Startup.cs, ...

  10. 字符串json转成json对象

    方法1 JsonSerializer serializer = new JsonSerializer(); TextReader tr = new StringReader(text); JsonTe ...