To modify the date format of nginx, you must modify the default log time format of 2010-08-23 17: 27: 11Nginx in nginx logs to 23/Aug/2010: 17: 26: 44 + 0800 1. before modifying src/http/modules/ngx_http_log_module.c first place: {ngx_string ("time_local"), sizeof ("28/Sep/1970: 12: 00: 00 + 0600 ") -1, ngx_http_log_time}, after modification: {ngx_string ("time_local"), sizeof ("12:00:00 + 0600")-1, ngx_http_log_time}, before the second www.2cto.com modification: return ngx_cpymem (buf, ngx_cached_http_log_time. Data, metadata); modified: return ngx_cpymem (buf, ngx_cached_err_log_time.data, metadata); 2. Modified 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); www.2cto.com modified (void) ngx_sprintf (p1, "% 4d-% 02d-% 02d % 02d: % 02d: % 02d", tm. ngx_tm_year, tm. n Gx_tm_mon, tm. ngx_tm_mday, tm. ngx_tm_hour, tm. ngx_tm_min, tm. ngx_tm_sec); Effect Comparison: before modification: 127.0.0.1---[05/Sep/2012: 13: 28: 46 + 080] "GET/HTTP/1.1" 200 151 "-" "Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv: 1.9.0.5) gecko/2008120908 Red Hat/3.0.5-1. el5_2 Firefox/3.0.5 "modified 127.0.0.1--[13:43:32]" GET/HTTP/1.1 "304 0"-"" Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv: 1.9.0.5) Gecko/2008120908 Red H At/3.0.5-1. el5_2 Firefox/3.0.5 "www.2cto.com also comes with the nginx smooth upgrade. Now we start to smoothly upgrade Nginx to stable version 1.0.0. 1. download the latest Nginx source package wget http://nginx.org/download/nginx-1.0.0.tar.gz 2. Configure and compile Nginx (do not execute make install steps) # tar zxvf nginx-1.0.0.tar.gz # cd nginx-1.0.0 #. /configure -- user = www -- group = www -- prefix =/web/nginx -- with-http_stub_status_module -- with-http_ssl_module # make (make compilation on OK, do not execute make install .) 3. Replace Nginx # mv/web/nginx/sbin/nginx. old of the old version with the nginx binary file. Www.2cto.com # cd objs/In the objs directory, you can see the newly compiled nginx binary file. # Cp nginx/web/nginx/sbin/copy the new nginx file to your nginx directory. #/Web/nginx/sbin/nginx-t test whether the new nginx version is configured properly. If the prompt is: the configuration file/web/nginx/conf/nginx. conf syntax is okconfiguration file/web/nginx/conf/nginx. conf test is successful, the configuration is correct. # Kill-USR2 'cat/web/nginx. Pi' to change nginx. pid to nginx. pid. oldbin and start the new nginx. # Kill-QUIT 'cat/web/nginx. pid. oldbin' to exit the earlier version of nginx. Www.2cto.com 4. confirm whether the upgrade is complete and check whether the upgrade is successful. #/Web/nginx/sbin/nginx-s reload to reload the configuration. # Obtain nginx version information from/web/nginx/sbin/Nginx-v. If the prompt is: nginx version: nginx/1.0.0, the upgrade is successful.