ITPub博客

首页 > IT职业 > IT职场 > 学习openresty时,nginx的一个坑

学习openresty时,nginx的一个坑

IT职场 作者:dead_lee 时间:2021-09-09 10:36:00 0 删除 编辑

正文

报错:

nginx: [error] CreateFile() “./logs/nginx.pid” failed (2: The system cannot find the file specified)

博主在执行了nginx -s stop后,再次启动nginx时报错:

图片描述

这个坑主要原因就是没有nginx.pid这个文件,./logs/下找不到nginx.pid文件,看了确实找不到。

看了网上很多方案是 需要建立nginx.pid文件,也就是要指定nginx.conf这个配置文件,然后博主很傻的这样执行了一把:

nginx -c  conf/nginx.conf

还是直接说正解吧 :开启你的cmd(命令列) 然后你需要以你nginx.exe所在路径的绝对路径,比如博主的路径在 D:Program Filesopenresty-1.13.6.2-win64

那么命令列就需要这样写
"d:Program Filesopenresty-1.13.6.2-win64nginx.exe" -c “d:Program Filesopenresty-1.13.6.2-win64confnginx.conf”

图片描述

生成了nginx.pid文件:
图片描述

里面只有一个PID号:
图片描述

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4686/viewspace-2824001/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2021-06-25

  • 博文量
    82
  • 访问量
    15435