NGINX配置开机启动执行命令:/etc/init.d/nginx start报错:nginx.service: Can‘t convert PID files /var/run/nginx.pid

NGINX配置开机启动执行命令:/etc/init.d/nginx start报错:nginx.service: Can’t convert PID files /var/run/nginx.pid O_PATH file descriptor to proper file descriptor

问题描述
配置NGINX开机启动时执行命令:/etc/init.d/nginx start报错:
nginx (via systemctl): Job for nginx.service failed because the service did not take the steps required by its unit configuration.
See “systemctl status nginx.service” and “journalctl -xe” for details.
[失败]
使用提示命令:systemctl status nginx.service返回:
在这里插入图片描述
分析原因:
红框部分提示No such file or directory是因为在/var/run/路径下没有nginx.pid这个进程文件生成
解决方案:
1.修改nginx.conf
如配置文件路径是:/usr/local/nginx/conf/nginx.conf则执行命令:
vi /usr/local/nginx/conf/nginx.conf
拷贝一行代码 #pid logs/nginx.pid; ,然后按a进入编辑模式,修改为报错提示的路径,即:pid /var/run/nginx.pid
在这里插入图片描述
按:wq保存退出
2.重新启动nginx
启动:/usr/local/nginx/sbin/nginx
3.执行命令:/etc/init.d/nginx start 出现下图表示问题已解决
在这里插入图片描述
注:执行命令:/etc/init.d/nginx start前需保证nginx进程已启动

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值