Home 解决/usr/local/var/run/nginx.pid" failed
Post
Cancel

解决/usr/local/var/run/nginx.pid" failed

问题描述

1
nginx启动或者重启失败,报错nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)

方案一

  1. 执行命令 :open /usr/local/etc/nginx 打开nginx安装目录 nginx安装目录默认位置有:
    • /etc/nginx/nginx.conf,
    • /usr/local/etc/nginx/nginx.conf 或 /usr/local/nginx/conf/nginx.conf
  2. 放开注释,改为:pid /usr/local/etc/nginx/logs/nginx.pid;
  3. 执行命令:mkdir /usr/local/etc/nginx/logs/usr/local/etc/nginx目录下创建目录logs
  4. 启动nginx

方案二

找到你的nginx.conf的文件夹目录,然后运行 nginx -c /usr/local/etc/nginx/nginx.conf命令 ,再运行(sudo)nginx -s reload 重启nginx就可以了

weixin.png

公众号名称:怪味Coding
微信扫码关注或搜索公众号名称
This post is licensed under CC BY 4.0 by the author.