windows nginx 配置问题处理及日志分割处理

本文介绍了Nginx中正确配置文件包含路径的方法,解决了因路径格式错误导致的文件无法找到的问题,并提供了一个用于定期重命名并归档访问日志的批处理脚本示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

主要是路径的问题

例如 include  C:\\nginx\\conf\\xxxxx\\*.conf;

这样是不行的

include  C:\nginx\conf\xxxxx\*.conf;

这样也是不行的


正确的:

include  C:\\nginx\\conf\\xxxxx/*.conf;

或者 include  C:/nginx/conf/xxxxx/*.conf;

这样才行。。


报错:

[emerg] 30908#69720: CreateFile() "xxxx.conf" failed (2: The system cannot find the file specified) in C:\nginx/conf/nginx.conf:42

另外文件最好是对应的编码格式,utf-8 no bom


另外访问日志会越来越大的处理

编写脚本如下:

taskkill /F /IM nginx.exe

 set "cmdstr=move C:\nginx\logs\access.log C:\nginx\logs\access.%date:~0,4%-%date:~5,2%-%date:~8,2%.log
call %cmdstr%"

net start nginx


参考:https://segmentfault.com/a/1190000006807506

https://www.cnblogs.com/allanhboy/archive/2011/11/10/2244461.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值