Improve production request logging

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
funnywolf
2026-07-06 14:52:22 +08:00
co-authored by Copilot
parent fae594ccd7
commit c11a5fca63
6 changed files with 26 additions and 2 deletions
+13
View File
@@ -1,7 +1,17 @@
log_format asp_main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" "$http_user_agent" '
'request_id=$request_id request_time=$request_time '
'upstream_addr="$upstream_addr" upstream_status="$upstream_status" '
'upstream_response_time="$upstream_response_time"';
server {
listen 443 ssl;
http2 on;
server_name _;
access_log /var/log/nginx/access.log asp_main;
access_log /var/log/asp/nginx/access.log asp_main;
error_log /var/log/nginx/error.log warn;
error_log /var/log/asp/nginx/error.log warn;
ssl_certificate /etc/nginx/certs/asp.crt;
ssl_certificate_key /etc/nginx/certs/asp.key;
@@ -21,6 +31,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-ID $request_id;
proxy_buffering off;
}
@@ -30,6 +41,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-ID $request_id;
}
location /admin/ {
@@ -38,6 +50,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-ID $request_id;
}
location /static/ {