# ISO8601 시간을 "YYYY-MM-DD HH:mm:ss" 형식으로 변환 map $time_iso8601 $time_custom { "~^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})" "$1-$2-$3 $4:$5:$6"; } # Go slog 포맷과 맞춘 JSON 액세스 로그 log_format json_combined escape=json '{' '"time":"$time_custom",' '"level":"INFO",' '"msg":"http_access",' '"svc":"baron-userfront",' '"status":$status,' '"method":"$request_method",' '"path":"$request_uri",' '"latency":"${request_time}s",' '"ip":"$remote_addr",' '"forwarded_for":"$http_x_forwarded_for",' '"user_agent":"$http_user_agent"' '}'; server { listen 5000; include /etc/nginx/mime.types; error_log /dev/stderr warn; access_log /var/log/nginx/access.log json_combined; # --- Backend API Proxy --- location /api { proxy_pass http://baron_backend:3000; proxy_set_header Host $host; 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; } # --- UserFront Static Files --- location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ /index.html; } }