当前位置: 首页 > news >正文

nginx 自启动失败:Failed to parse PID from file: Invalid argument

记一次nginx自启动配置的问题
我的配置如下:

[Unit]
Description=A high performance web server and a reverse proxy server
After=network.target[Service]
Type=forking
PIDFile=/home/u24/nginx/pid/nginx.pid
ExecStartPre=/home/u24/nginx/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/home/u24/nginx/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/home/u24/nginx/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=/bin/kill -s TERM $MAINPID[Install]
WantedBy=multi-user.target

执行 systemctl start nginx.service 后启动失败,提示

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

于是根据 journalctl -xeu nginx.service 中的提示,先是报找不到 /home/u24/nginx/pid/nginx.pid 这个文件,于是我手动创建了这个文件。
再次启动报 Failed to parse PID from file /home/u24/nginx/pid/nginx.pid: Invalid argument,确认了nginx.pid 文件的访问权限后,发现 nginx 的配置中,没有指定 pid 的文件文件,于是修改 nginx.conf ,在最外层添加配置

user  u24;
worker_processes  1;
#新增
pid        /home/u24/nginx/pid/nginx.pid;

再次启动,成功。

http://www.lryc.cn/news/498356.html

相关文章:

  • Wwise SoundBanks内存优化
  • centos 常见问题处理
  • 简述Vue每个周期具体适合哪些场景?
  • Alibaba Druid(简称Druid)
  • linux protobuf的安装与使用
  • 关于Chrome自动同步书签的解决办法
  • 基于深度学习的甲状腺结节影像自动化诊断系统(PyQt5界面+数据集+训练代码)
  • docker常用操作命令
  • Android:生成Excel表格并保存到本地
  • JVM-程序计数器与栈
  • 【kotlin 】内联类(value class / inline class)
  • 【SpringBoot】使用IDEA创建SpringBoot项目
  • C++设计模式(原型、代理、适配器、组合)
  • 如何在CentOS 7上使用FreeIPA设置集中式Linux身份验证
  • vue2播放视频和预览文件的组件以及使用方法
  • 性能之巅:Go语言优化深度探索
  • react + antd desgin 使用form功能时upload,radio,checkbox不能回显的问题
  • 【08】MySQL复杂查询:子查询语句详解与示例
  • Unity 相机旋转及角度限制
  • error=‘null‘], commandType=io.lettuce.core.RedisPublisher$SubscriptionCommand]
  • Golang 字符串字面量表示方法
  • 03_Webpack模块打包工具
  • 【目标跟踪】AntiUAV600数据集详细介绍
  • 十、JavaScript的应用的习题
  • 【Spring】AOP
  • 三维地图,智慧城市,商业智能BI,数据可视化大屏(Cesiumjs/UE)
  • 鸿蒙Next通过oss上传照片到阿里云
  • 小白爬虫——selenium入门超详细教程
  • nlp培训重点
  • 什么是多模态和模态