Files
asepharyana-hub/infra/dashboard/nginx.conf
T
asepharyana ee4fd677ea feat(infra): add Prometheus and Chart.js dashboard with real-time charts
- Add Prometheus server scraping OTel collector
- Add Chart.js donut chart for service health distribution
- Add line charts for RPS, latency, error rate, trace volume
- Add Prometheus API proxy to nginx whitelist
- Restructure dashboard layout with 12-column responsive grid
2026-07-22 18:26:41 +07:00

112 lines
3.0 KiB
Nginx Configuration File

# Dashboard nginx — runs as root to access Docker socket
user root;
worker_processes auto;
pid /var/run/nginx.pid;
pcre_jit on;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
# Gzip
gzip on;
gzip_types text/html text/css application/javascript application/json;
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy same-origin;
# Jaeger API proxy
location /api/jaeger/ {
proxy_pass http://jaeger:16686/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_read_timeout 30s;
}
# Jaeger UI
location /jaeger/ {
proxy_pass http://jaeger:16686/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400s;
}
# OTel collector prometheus metrics
location /api/metrics {
proxy_pass http://otel-collector:8889/metrics;
proxy_set_header Host $host;
proxy_read_timeout 10s;
}
# OTel collector health
location /api/health {
proxy_pass http://otel-collector:13133/;
proxy_read_timeout 5s;
}
# Prometheus API (read-only queries)
location /api/prometheus/ {
proxy_pass http://prometheus:9090/;
proxy_set_header Host $host;
proxy_read_timeout 15s;
}
# Docker API proxy — strict whitelist (read-only Unix socket)
# Uses exact match (=) to avoid regex+proxy_pass URI limitation.
location = /api/docker/containers/json {
proxy_pass http://unix:/var/run/docker.sock:/containers/json;
proxy_set_header Host $host;
proxy_read_timeout 10s;
}
location = /api/docker/version {
proxy_pass http://unix:/var/run/docker.sock:/version;
proxy_set_header Host $host;
proxy_read_timeout 10s;
}
# Deny all other Docker API access
location /api/docker/ {
deny all;
return 403;
}
# Static files
location / {
try_files $uri $uri/ /index.html;
expires 5s;
add_header Cache-Control "public, must-revalidate";
}
# Deny hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
error_page 404 /index.html;
}
}