首页 > 代码库 > nginx 设置日志分割

nginx 设置日志分割

 

server {

        listen       80;

        server_name  bmw2.thefront.com.cn;


        charset utf-8;


        if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {

            set $year $1;

            set $month $2;

            set $day $3;

        }


        access_log  /home/weblogs/bmw2.thefront.com.cn.access.$year.$month.$day.log main;

        error_log /home/weblogs/bmw2.thefront.com.cn.error.log warn;


        root /home/web/bmw-event;

        add_header front-end web01;

        location / {

            root   /home/web/bmw-event;

            index  index.php index.html index.htm;

        }

调用参数 year month day进行日期分割

nginx 设置日志分割