11# Load the OpenTelemetry (OTel) module for NGINX
22load_module modules/ngx_otel_module.so;
33
4- worker_processes auto; # Use one worker per CPU core
5- pid /tmp/nginx.pid ; # PID file in /tmp ( container-friendly )
6- env OTEL_EXPORTER_OTLP_ENDPOINT ; # Inherit the environment variable into NGINX
4+ worker_processes auto;
5+ pid /tmp/nginx.pid ;
6+ error_log /dev/stderr warn ;
77
88events {
9- worker_connections 2048 ; # Max connections per worker
10- use epoll; # Efficient Linux event notification mechanism
11- multi_accept on; # Accept multiple connections at once
9+ worker_connections 2048 ;
10+ use epoll;
11+ multi_accept on;
1212}
1313
1414http {
15- # Map the environment variable to a configuration variable, with fallback
16- map $OTEL_EXPORTER_OTLP_ENDPOINT $otel_exporter_endpoint {
17- default $OTEL_EXPORTER_OTLP_ENDPOINT ;
18- "" "http://grafana-tempo.grafana:4317" ;
19- }
15+ include /etc/nginx/mime.types ;
16+ default_type application/octet-stream ;
2017
21- # OpenTelemetry exporter configuration
18+ # OTEL exporter
2219 otel_exporter {
23- endpoint $otel_exporter_endpoint ; # Send spans to this endpoint
24- interval 1s ; # Flush interval
25- batch_size 2048 ; # Maximum spans per batch
20+ endpoint http ://grafana-tempo.grafana: 4317 ;
21+ interval 1s ;
22+ batch_size 2048 ;
2623 }
2724
28- otel_service_name "shortlink-ui" ; # Service name seen in tracing backend
29- otel_trace on; # Enable tracing for HTTP requests
30- otel_trace_context propagate; # Propagate W3C trace context to upstream
25+ otel_service_name "shortlink-ui" ;
26+ otel_trace on;
27+ otel_trace_context propagate;
3128
32- # Temporary file paths (suitable for containers )
29+ # Temp paths (container-safe )
3330 proxy_temp_path /tmp/proxy_temp;
3431 client_body_temp_path /tmp/client_temp;
3532 fastcgi_temp_path /tmp/fastcgi_temp;
3633 uwsgi_temp_path /tmp/uwsgi_temp;
3734 scgi_temp_path /tmp/scgi_temp;
3835
39- # Static file & connection optimisations
40- sendfile on;
41- tcp_nopush on;
42- tcp_nodelay on;
36+ # IO options
37+ sendfile on;
38+ tcp_nopush on;
39+ tcp_nodelay on;
4340 keepalive_timeout 65s ;
4441 keepalive_requests 1000 ;
4542
46- include /etc/nginx/mime.types ;
47- default_type application/octet-stream ;
48-
49- # Logging in JSON format, including trace IDs
43+ # Logging (JSON format)
5044 map $upstream_response_time $temprt {
5145 default $upstream_response_time ;
5246 "" 0;
@@ -66,14 +60,13 @@ http {
6660 '"http_referrer":"$http_referer",'
6761 '"http_user_agent":"$http_user_agent"}' ;
6862
69- access_log /var/log/nginx/access.log json;
70- error_log /var/log/nginx/error.log warn;
63+ access_log /dev/stdout json;
7164
72- # Gzip compression settings
73- gzip on;
74- gzip_min_length 10240 ;
75- gzip_proxied any;
76- gzip_disable "msie6" ;
65+ # Gzip
66+ gzip on;
67+ gzip_min_length 10240 ;
68+ gzip_proxied any;
69+ gzip_disable "msie6" ;
7770 gzip_types
7871 text/plain
7972 text/css
8376 application/javascript
8477 image/svg+xml;
8578
86- # Include other server/location configs
87- include /etc/nginx/conf.d/*;
79+ include /etc/nginx/conf.d/default.conf;
8880}
0 commit comments