nginx日誌切割配置

snale1989發表於2016-09-05

編輯虛擬主機檔案 /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;

 

相關文章