nginx 官方 docker 镜像日志文件的映射保存
docker 镜像内路径:/var/log/nginx
在 nginx.conf 中配置日志按时间生成(在 server 节点中插入以下配置,未验证):
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; set $minutes $5; set $seconds $6; } #访问日志 按小时 access_log /var/log/nginx/$year-$month-$day-access.log; #错误日志 error_log /var/log/nginx/$year-$month-$day-error.log;
输了你,赢了世界又如何...