nginx日志切割配置

编辑虚拟主机文件 /etc/nginx/conf.d/default.conf  在server段添加如下配置

if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})"){
                    set $year $1;
                    set $month $2;
                    set $day $3;
            }
            access_log /data/logs/app_$year-$month-$day.log main;

 

posted @ 2016-09-05 10:42  snale1989  阅读(236)  评论(0编辑  收藏  举报