Nginx日志按天进行切割
先创建如下脚本:
/usr/local/nginx/sbin/nginxlogs.sh
#! /bin/bash
d=`date -d "-1 day" +%Y%m%d`
/bin/mv /usr/local/nginx/logs/access.log /usr/local/nginx/logs/nginx_access_$d.log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` #让nginx重新生成日志
#/etc/init.d/nginx reload >/dev/null 2>/dev/null 继续阅读