修改代码
修改src/http/modules/ngx_http_log_module.c
{ ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1,
ngx_http_log_time },
修改后:
{ ngx_string("time_local"), sizeof("1970-09-28 12:00:00 +0600") - 1,
ngx_http_log_time },
return ngx_cpymem(buf, ngx_cached_http_log_time.data,
ngx_cached_http_log_time.len);
修改后:
return ngx_cpymem(buf, ngx_cached_err_log_time.data,
ngx_cached_err_log_time.len);
修改 src/core/ngx_times.c
(void) ngx_sprintf(p1, "%4d/%02d/%02d %02d:%02d:%02d",
tm.ngx_tm_year, tm.ngx_tm_mon,
tm.ngx_tm_mday, tm.ngx_tm_hour,
tm.ngx_tm_min, tm.ngx_tm_sec);
修改后
(void) ngx_sprintf(p1, "%4d-%02d-%02d %02d:%02d:%02d",
tm.ngx_tm_year, tm.ngx_tm_mon,
tm.ngx_tm_mday, tm.ngx_tm_hour,
tm.ngx_tm_min, tm.ngx_tm_sec);
编译安装
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install