为避免日志文件太大,同时也便于分析日志文件,可以将NGINX配置为每小时生成一个日志文件。
配置的办法是,在\conf\nginx.conf 中
在server 部分,如:
server { …… 加上以下内容:
listen 443 ssl;
server_name www.zww.cn;
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})")
{set $year $1;
set $month $2;
set $day $3;
set $hour $4;
}
access_log logs/$host/$year-$month-$day-$hour.log main if=$loggable;