From 339582dddd0ab32f04fb695cfc0995e9e96d455b Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Wed, 18 Feb 2026 04:49:33 +0800 Subject: [PATCH 1/4] Refine cache settings for response status codes Updated cache configuration to specify valid status codes and their cache durations. --- docker_openresty/work/nginx/conf.d/include/cache.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker_openresty/work/nginx/conf.d/include/cache.conf b/docker_openresty/work/nginx/conf.d/include/cache.conf index 8659cf9..561f753 100644 --- a/docker_openresty/work/nginx/conf.d/include/cache.conf +++ b/docker_openresty/work/nginx/conf.d/include/cache.conf @@ -9,8 +9,8 @@ # ignore these headers for media proxy_ignore_headers Set-Cookie Cache-Control Expires X-Accel-Expires; - # cache 200s and also 404s (not ideal but there are a few 404 images for some reason) - proxy_cache_valid any 30m; + # cache 200s for 30 minutes and cache 404s for 1 minute + proxy_cache_valid 200 206 30m; proxy_cache_valid 404 1m; # strip this header to avoid If-Modified-Since requests From 9acc470db75a71572d1624d8eddcf03718c08bee Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Wed, 18 Feb 2026 04:50:34 +0800 Subject: [PATCH 2/4] Clean up log-standard.conf by removing comments Removed commented log format table from log-standard.conf --- .../nginx/conf.d/include/log-standard.conf | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/docker_openresty/work/nginx/conf.d/include/log-standard.conf b/docker_openresty/work/nginx/conf.d/include/log-standard.conf index fb99f8e..7e4f1ab 100644 --- a/docker_openresty/work/nginx/conf.d/include/log-standard.conf +++ b/docker_openresty/work/nginx/conf.d/include/log-standard.conf @@ -2,35 +2,3 @@ log_format standard escape=json '{"T":"$fmt_localtime","t":"$request_time","tr": log_format proxy escape=json '{"T":"$fmt_localtime","t":"$request_time","tr":"$upstream_response_time","s":"$status","r":"$remote_addr","m":"$request_method","e":"$scheme","h":"$host","u":"$request_uri","R":"$http_x_forwarded_for","L":"$body_bytes_sent","G":"$gzip_ratio","a":"$http_user_agent","f":"$http_referer","U":"$upstream_status","C":"$upstream_cache_status","S":"$server_name"}'; access_log /var/log/nginx/fallback_access.log proxy; - -## Log formats: -#| JSON key | standard | proxy | stream | -#| -------- | ------------------------- | ------------------------- | -------------------------- | -#| `T` | `$fmt_localtime` | `$fmt_localtime` | `$fmt_localtime` | -#| `t` | `$request_time` | `$request_time` | — | -#| `tr` | `$upstream_response_time` | `$upstream_response_time` | — | -#| `ts` | — | — | `$session_time` | -#| `tc` | — | — | `$upstream_connect_time` | -#| `s` | `$status` | `$status` | `$status` | -#| `r` | `$remote_addr` | `$remote_addr` | `$remote_addr` | -#| `m` | `$request_method` | `$request_method` | — | -#| `e` | `$scheme` | `$scheme` | — | -#| `h` | `$host` | `$host` | — | -#| `u` | `$request_uri` | `$request_uri` | — | -#| `R` | `$http_x_forwarded_for` | `$http_x_forwarded_for` | — | -#| `L` | `$body_bytes_sent` | `$body_bytes_sent` | — | -#| `G` | `$gzip_ratio` | `$gzip_ratio` | — | -#| `a` | `$http_user_agent` | `$http_user_agent` | — | -#| `f` | `$http_referer` | `$http_referer` | — | -#| `U` | — | `$upstream_status` | — | -#| `C` | — | `$upstream_cache_status` | — | -#| `S` | — | `$server_name` | — | -#| `P` | — | — | `$protocol` | -#| `p` | — | — | `$remote_port` | -#| `bs` | — | — | `$bytes_sent` | -#| `br` | — | — | `$bytes_received` | -#| `ua` | — | — | `$upstream_addr` | -#| `ubs` | — | — | `$upstream_bytes_sent` | -#| `ubr` | — | — | `$upstream_bytes_received` | -#| `ssl_p` | — | — | `$ssl_protocol` | -#| `ssl_c` | — | — | `$ssl_cipher` | From 48f68ada1538c90af368a000030fea268440406c Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Wed, 18 Feb 2026 04:51:10 +0800 Subject: [PATCH 3/4] Clean up log-stream.conf by removing comments Removed commented log format documentation from log-stream.conf. --- .../work/nginx/conf.d/include/log-stream.conf | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/docker_openresty/work/nginx/conf.d/include/log-stream.conf b/docker_openresty/work/nginx/conf.d/include/log-stream.conf index 2044b87..11f3f3e 100644 --- a/docker_openresty/work/nginx/conf.d/include/log-stream.conf +++ b/docker_openresty/work/nginx/conf.d/include/log-stream.conf @@ -1,35 +1,3 @@ log_format stream escape=json '{"T":"$fmt_localtime","ts":"$session_time","tc":"$upstream_connect_time","s":"$status","r":"$remote_addr","P":"$protocol","p":"$remote_port","bs":"$bytes_sent","br":"$bytes_received","ua":"$upstream_addr","ubs":"$upstream_bytes_sent","ubr":"$upstream_bytes_received","ssl_p":"$ssl_protocol","ssl_c":"$ssl_cipher"}'; access_log /var/log/nginx/fallback_stream_access.log stream; - -## Log formats: -#| JSON key | standard | proxy | stream | -#| -------- | ------------------------- | ------------------------- | -------------------------- | -#| `T` | `$fmt_localtime` | `$fmt_localtime` | `$fmt_localtime` | -#| `t` | `$request_time` | `$request_time` | — | -#| `tr` | `$upstream_response_time` | `$upstream_response_time` | — | -#| `ts` | — | — | `$session_time` | -#| `tc` | — | — | `$upstream_connect_time` | -#| `s` | `$status` | `$status` | `$status` | -#| `r` | `$remote_addr` | `$remote_addr` | `$remote_addr` | -#| `m` | `$request_method` | `$request_method` | — | -#| `e` | `$scheme` | `$scheme` | — | -#| `h` | `$host` | `$host` | — | -#| `u` | `$request_uri` | `$request_uri` | — | -#| `R` | `$http_x_forwarded_for` | `$http_x_forwarded_for` | — | -#| `L` | `$body_bytes_sent` | `$body_bytes_sent` | — | -#| `G` | `$gzip_ratio` | `$gzip_ratio` | — | -#| `a` | `$http_user_agent` | `$http_user_agent` | — | -#| `f` | `$http_referer` | `$http_referer` | — | -#| `U` | — | `$upstream_status` | — | -#| `C` | — | `$upstream_cache_status` | — | -#| `S` | — | `$server_name` | — | -#| `P` | — | — | `$protocol` | -#| `p` | — | — | `$remote_port` | -#| `bs` | — | — | `$bytes_sent` | -#| `br` | — | — | `$bytes_received` | -#| `ua` | — | — | `$upstream_addr` | -#| `ubs` | — | — | `$upstream_bytes_sent` | -#| `ubr` | — | — | `$upstream_bytes_received` | -#| `ssl_p` | — | — | `$ssl_protocol` | -#| `ssl_c` | — | — | `$ssl_cipher` | From fb14cd0d596b7fd0de275ad08f613123aa0b3637 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Wed, 18 Feb 2026 04:52:24 +0800 Subject: [PATCH 4/4] Update README.md --- docker_openresty/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docker_openresty/README.md b/docker_openresty/README.md index ff1457e..21bfc49 100644 --- a/docker_openresty/README.md +++ b/docker_openresty/README.md @@ -65,3 +65,37 @@ You can add your custom configuration snippet files at /data/nginx/custom as fol - `conf/server_stream_tcp.conf`: Included at the end of every TCP stream server block - `conf/server_stream_udp.conf`: Included at the end of every UDP stream server block - `/data/nginx/custom/server_dead.conf`: Included at the end of every 404 server block +- + +## Log fields mappings + +| JSON key | standard | proxy | stream | +| -------- | ------------------------- | ------------------------- | -------------------------- | +| `T` | `$fmt_localtime` | `$fmt_localtime` | `$fmt_localtime` | +| `t` | `$request_time` | `$request_time` | — | +| `tr` | `$upstream_response_time` | `$upstream_response_time` | — | +| `ts` | — | — | `$session_time` | +| `tc` | — | — | `$upstream_connect_time` | +| `s` | `$status` | `$status` | `$status` | +| `r` | `$remote_addr` | `$remote_addr` | `$remote_addr` | +| `m` | `$request_method` | `$request_method` | — | +| `e` | `$scheme` | `$scheme` | — | +| `h` | `$host` | `$host` | — | +| `u` | `$request_uri` | `$request_uri` | — | +| `R` | `$http_x_forwarded_for` | `$http_x_forwarded_for` | — | +| `L` | `$body_bytes_sent` | `$body_bytes_sent` | — | +| `G` | `$gzip_ratio` | `$gzip_ratio` | — | +| `a` | `$http_user_agent` | `$http_user_agent` | — | +| `f` | `$http_referer` | `$http_referer` | — | +| `U` | — | `$upstream_status` | — | +| `C` | — | `$upstream_cache_status` | — | +| `S` | — | `$server_name` | — | +| `P` | — | — | `$protocol` | +| `p` | — | — | `$remote_port` | +| `bs` | — | — | `$bytes_sent` | +| `br` | — | — | `$bytes_received` | +| `ua` | — | — | `$upstream_addr` | +| `ubs` | — | — | `$upstream_bytes_sent` | +| `ubr` | — | — | `$upstream_bytes_received` | +| `ssl_p` | — | — | `$ssl_protocol` | +| `ssl_c` | — | — | `$ssl_cipher` |