self-host/proxy/nginx/conf.d/grafana.conf

34 lines
932 B
Text
Raw Normal View History

2025-03-09 15:51:47 +00:00
# HTTP configuration
# -- Redirect all HTTP requests to HTTPS port
server {
listen 80; # HTTP port
server_name grafana.systemsobscure.net;
location / {
return 301 https://$host$request_uri; # Variable is a placeholder for all requests to the server name
}
}
# HTTPS configuration
server {
listen 443 ssl;
server_name grafana.systemsobscure.net;
# SSL configuration
2025-03-09 16:36:38 +00:00
ssl_certificate /etc/letsencrypt/live/systemsobscure.net/fullchain.pem;
2025-03-09 15:51:47 +00:00
ssl_certificate_key /etc/letsencrypt/live/systemsobscure.net/privkey.pem;
# Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Proxy Configuration
location / {
2025-04-05 14:19:41 +01:00
proxy_pass http://grafana:3000; # Docker network address
2025-03-09 15:51:47 +00:00
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;
}
}