nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument解决
2024-09-01 12:35:38
先附上错误信息:
(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
然后我们再重启一下就好了。
最新文章
- [Gnu]Centos7 解决 gdb 提示 Missing separate debuginfos
- Sublime Text 3初阶
- 反射动态创建不同的Processor
- 【使用 DOM】使用 Document 对象
- js中使用s(c)标签
- SharePoint的实体生成
- Python中*和**的用法
- 单片微机原理P4:80C51串口与串行总线拓展
- MySql的like语句中的通配符:百分号、下划线和escape 的使用
- Python多线程2:sched
- javac不是内部命令和外部命令
- 你不知道的JavaScript--Item1 严格模式
- MIUI系统如何获取ROOT权限
- 线程中的队列(queue)
- Battery historian安装及使用
- (三)apache的安装与配置
- Windows Server 2008中使用计划任务定时执行BAT bat进行PHP脚本的执行
- 如何写一个好的缺陷(Defect)报告
- ERROR 2003:Can't connect to MySQL server on 'localhost'
- Knockout.Js官网学习(checked 绑定)