nginx 按天生成日志

月小升记得以前nginx没有办法读取日期,今天找到个办法居然可以。

server{
   location ~ \.php$ {
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
        if ($time_iso8601 ~ '(\d{4}-\d{2}-\d{2})') {
            set $tttt $1;
        }
 
        access_log  /backup/wwwlogs/$tttt.java-er.com.log;
}

系统自动生成了2020-09-07.java-er.com.log文件

posted @ 2023-04-24 10:39  甜菜波波  阅读(162)  评论(0编辑  收藏  举报