nginx 记录日志并以时间文件命名


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
     
    worker_connections  1024;
}

http {
     
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr,$time_iso8601|$query_string';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
     
        listen       8099;
        server_name  localhost;
		
		#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;
		#}
		if ($time_iso8601 ~ "(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
     
			set $time $1$2$3$4;
		}
        #charset koi8-r;

        access_log  e:/nmenu_ad/nmenu.ad.api.logs/${time}.log  main;

        location / {
     
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
     
            root   html;
        }
    }



}

你可能感兴趣的:(笔记,nginx)