背景

修改nginx配置文件nginx.conf后,想要重启nginx使配置生效。cmd进入nginx安装目录,输入命令: nginx -s reload

报错:nginx: [error] CreateFile() "D:\nginx-1.20.1/logs/nginx.pid" failed (2: The system cannot find the file specified)

原因分析

  • 问题的直接原因就是在nginx的安装目录下的logs目录里面没有nginx.pid这个文件,一般情况下nginx启动时会自动创建nginx.pid文件的
  • nginx启动或者重启需要杀掉原来的nginx进程,需要根据nginx.pid找到原来的进程,其中pid其实就是原来的进程ID了
  • 出现这种情况的原因可能是nginx未启动或者nginx.pid被手动删除掉,有时候在windows系统通过双击方式启动nginx会有无法在logs目录下自动生成nginx.pid文件的情况
  • 在没有启动nginx的情况下(以及你不清楚有没有启动),不要使用nginx -s reload命令来作为启动命令,可以避免这个报错发生

解决方法

1.任务管理器里面找到原来的nginx进程(如果有的话)并关掉,然后使用cmd命令的方式启动nginx

2.cmd 进入 nginx安装目录

3.输入命令 start nginx 或者 nginx.exe 启动nginx

4.去nginx目录下logs目录下看看有没有nginx.pid的文件;如果没有重复123操作

5.如果nginx.pid已经生成,再去修改配置文件后就可以正常重启了

6.nginx -s reload

Nginx系列(6)- nginx: [error] CreateFile() "D:\nginx-1.20.1/logs/nginx.pid" failed (2: The system cannot find the file specified)的更多相关文章

  1. nginx报错[error] CreateFile() "D:\Java-windows\nginx-1.16.0/logs/nginx.pid" failed (2: The system cannot find the file specified)

    无论是nginx -s stop还是nginx -s reload命令,都会出现这个错误. 解决方法:使用命令创建/logs/nginx.pid文件,命令如下所示: nginx -c conf/ngi ...

  2. Nginx错误:nginx: [error] OpenEvent("Global\ngx_reload_6252") failed (2: The system cannot find the file specified)

    执行nginx -s reload命令: nginx: [error] OpenEvent("Global\ngx_reload_6252") failed (2: The sys ...

  3. nginx错误: [error] OpenEvent("Global\ngx_reload_10444") failed (2: The system cannot find the file specified)

    执行nginx -s reload命令: nginx: [error] OpenEvent("Global\ngx_reload_10444") failed (2: The sy ...

  4. Nginx报错 nginx: [error] open() "/usr/local/nginx-1.6.3/logs/nginx.pid" failed (2: No such file or directory)

    问题: 解决: http://www.jianshu.com/p/918eb337a206 dd

  5. Nginx系列(4)- Nginx安装 | Windows

    下载 访问官网,选择稳定版对应的Windows系列 安装解压即可 启动nginx 有很多种方法启动nginx 直接双击nginx.exe,双击后一个黑色的弹窗一闪而过 打开cmd命令窗口,切换到ngi ...

  6. Windows下nginx报错解决:CreateFile() "xxx/logs/nginx.pid" failed

    写在前面 本文给出Windows下nginx报错:CreateFile() "xxx/logs/nginx.pid" failed 的解决方法并分析了出错原因,其中 xxx 表示n ...

  7. 解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误

    重新启动服务器,访问web服务发现无法浏览,登陆服务器之 后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr ...

  8. nginx ../logs/nginx.pid" failed (2: No such file or directory)

    [1]nginx.pid相关 (1)可能出现两种场景: 1.1 nginx.pid文件不存在 发生现象:nginx: [error] open() "/usr/local/lib/ubcsr ...

  9. nginx: [error] CreateFile() "E:\nginx\nginx-1.9.3/logs/nginx.pid" failed

    nginx: [error] CreateFile() "E:\nginx\nginx-1.9.3/logs/nginx.pid" failed nginx: [error] Op ...

随机推荐

  1. Windows内核-7-(IRP)I/O请求包

    Windows内核-7-(IRP)I/O请求包 IRP(I/O Request Packet)就是一个进行I/O操作的请求包. IRP是一个结构体,谁分配谁就得释放,通常由执行体里的管理器,获取内核驱 ...

  2. Python实现发送邮件(实现单发/群发邮件验证码)

    Python smtplib 教程展示了如何使用 smtplib 模块在 Python 中发送电子邮件. 要发送电子邮件,我们使用 Python 开发服务器,Mailtrap 在线服务和共享的网络托管 ...

  3. 【Azure 应用服务】App Service For Container 配置Nginx,设置/home/site/wwwroot/目录为启动目录,并配置反向代理

    问题描述 通过Docker Desktop for Linux,配置Nginx镜像后,自定义nginx.conf文件,修改启动目录和对 /out 路径的反向代理到博客园的博文地址 (https://w ...

  4. MySQL主从复制与Atlas读写分离

    配置主从复制 1. 增加主从配置 # 主库配置文件 server-id = 1 log-bin = /var/lib/mysql/mysql-bin expire_logs_days = 10 ski ...

  5. AbpVnext使用分布式IDistributedCache Redis缓存(自定义扩展方法)

    AbpVnext使用分布式IDistributedCache缓存from Redis(带自定义扩展方法) 我的依赖包的主要版本以及Redis依赖如下 1:添加依赖 <PackageReferen ...

  6. Spring笔记(1)

    Spring快速入门 开发步骤 导入坐标 <dependency> <groupId>org.springframework</groupId> <artif ...

  7. FeignClient注解属性configuration不生效问题排查思路

    FeignClient注解属性configuration不生效问题排查思路 问题背景 我们知道,"如果需要自定义单个Feign配置,Feign的@Configuration 注解的类不能与@ ...

  8. UOS LoongArch 上成功安装.NET Core 3.1

    龙芯.NET团队正式发布了.NET Core 3.1 For LoongArch, 具体参见龙芯开源网站 http://www.loongnix.cn/index.php/Dotnet . 进入安装包 ...

  9. How to check type of files without extensions in python? 不通过文件扩展名,怎样知道文件类型?

    有一个命令 file 可以用 $ file fuck fuck.png: PNG image data, 1122 x 750, 8-bit colormap, non-interlaced pyth ...

  10. AWS扩容EC2实例根空间

    文章原文 aws 端操作 先在EC2 实例中选中磁盘 然后打开跟设备 修改大小后保存 ec2 端操作 lsblk 查看当前设备的磁盘编号 df -T -H 查看扩容前的空间大小并确定磁盘格式 grow ...