zoukankan      html  css  js  c++  java
  • Linux-026-Centos Nginx 配置 pid 文件路径解决 service nginx status 提示:Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory

    在使用 service nginx status 命令查看 nginx 的运行状态时,提示:Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory

    导致 nginx 服务关闭,服务不可用,具体提示信息如下所示

    查看 nginx.conf 配置文件,发现未配置 nginx.pid 的文件路径。后经查询官方文档,可知 nginx.pid 默认保存在了 nginx 安装目录下的 logs 目录下。

    nginx.pid 的路径是可以通过配置实现,有如下两种方式:

    1. 通过 nginx.conf 配置文件,指定 pid 文件路径
    2. 在编译安装 nginx 时,通过 --pid-path=PATH 指定 nginx.pid 的文件路径,此处的路径需要使用绝对路径

    无论是用何种方式进行 nginx.pid 文件路径,建议默认配置路径为 /var/run/nginx.pid

    修改 conf/nginx.conf,在文件中添加如下图中红色所示的配置,指定 pid 文件的全路径。

    在检查 nginx 配置通过,重新加载配置后,查看 nginx 的状态就不会有异常存在了。

    nginx -t
    nginx -s reload
    
    service nginx status

     查看 nginx 运行状态命令行输出如下所示

    我本渺小,但山峰,我一次次绝顶!


    PS:若有错误,敬请告知,不胜感激!
    Copyright @范丰平 版权所有,如需转载请标明本文原始链接出处,严禁商业用途! 我的个人博客链接地址:http://www.cnblogs.com/fengpingfan
  • 相关阅读:
    Sqlite数据库sqlite3命令
    cerr
    include 尖括号和双引号
    C程序存储空间布局——各数据段的内存位置
    贪心算法
    CodeBlocks
    O(n)是什么
    微软公司面试题
    CSS3---结构性伪类选择器—not
    CSS3---结构性伪类选择器-root
  • 原文地址:https://www.cnblogs.com/fengpingfan/p/14513312.html
Copyright © 2011-2022 走看看