默认 nginx 不支持 log自动分割
windows下 解决方案:
1、首先创建bat脚本 split_log.bat , 并保存在nginx 目录下:
@echo off rem 查看系统中正在运行的nginx进程 rem tasklist /fi "imagename eq nginx.exe" rem 备份并根据时间重命名访问日志文件 NET STOP "nginx" set "cmdstr=move C: ginxlogsaccess.log C: ginxlogsHisaccess.%date:~0,4%-%date:~5,2%-%date:~8,2%.log call %cmdstr%" rem 备份并根据时间重命名错误日志文件 set "cmdstr=move C: ginxlogserror.log C: ginxlogsHiserror.%date:~0,4%-%date:~5,2%-%date:~8,2%.log call %cmdstr%" rem re-opening log files NET START "nginx"
2、 创建计划任务
1)

2、

3、
