This commit is contained in:
Dallas Lu 2026-06-09 14:41:15 +08:00
parent c50569d73e
commit a624163120
No known key found for this signature in database
27 changed files with 215 additions and 6 deletions

View file

@ -1,6 +1,9 @@
# Enable gzip for common text-based responses.
gzip on;
gzip_vary on;
# Keep the default compression level moderate so the CPU cost stays predictable
# on small VPS instances.
gzip_comp_level 4;
gzip_min_length 256;
@ -27,3 +30,6 @@ gzip_types
text/plain
text/xml
text/vtt;
# Do not list text/html here. nginx already compresses it implicitly, and
# repeating it suggests callers need to keep the two lists in sync.

View file

@ -0,0 +1,23 @@
# Define a reusable access log format with upstream timing fields, but do not
# enable logging by default. Individual servers still choose their own log path
# and whether this format is worth the I/O cost.
#
# Example:
# access_log /var/log/nginx/access.log upstream_timing;
log_format upstream_timing escape=json
'{'
'"time":"$time_iso8601",'
'"remote_addr":"$remote_addr",'
'"host":"$host",'
'"request":"$request",'
'"status":$status,'
'"body_bytes_sent":$body_bytes_sent,'
'"request_time":$request_time,'
'"upstream_addr":"$upstream_addr",'
'"upstream_status":"$upstream_status",'
'"upstream_connect_time":"$upstream_connect_time",'
'"upstream_header_time":"$upstream_header_time",'
'"upstream_response_time":"$upstream_response_time",'
'"http_referer":"$http_referer",'
'"http_user_agent":"$http_user_agent"'
'}';

View file

@ -1,3 +1,5 @@
# Map Upgrade to a reusable Connection value so websocket locations can opt in
# without hard-coding "upgrade" for every request.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;