windows 下 nginx log 分割

 默认 nginx 不支持 log自动分割nginx

 
  windows下 解决方案:
 
 一、首先建立bat脚本 split_log.bat , 并保存在nginx 目录下:
@echo off
rem 查看系统中正在运行的nginx进程
rem tasklist /fi "imagename eq nginx.exe"
rem 备份并根据时间重命名访问日志文件
NET STOP "nginx"
set "cmdstr=move C:\nginx\logs\access.log C:\nginx\logsHis\access.%date:~0,4%-%date:~5,2%-%date:~8,2%.log
call %cmdstr%"
rem 备份并根据时间重命名错误日志文件
set "cmdstr=move C:\nginx\logs\error.log C:\nginx\logsHis\error.%date:~0,4%-%date:~5,2%-%date:~8,2%.log
call %cmdstr%"
rem re-opening log files
NET START "nginx"

  

 二、 建立计划任务
 
     1)
二、
 
三、
 

 
 
 
 
 



相关文章
相关标签/搜索