map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream grafana { server localhost:4000; } server { listen 80; server_name grafana.secretbee.buzz; location / { return 301 https://$host$request_uri; } } server { listen 443; server_name grafana.secretbee.buzz; add_header Strict-Transport-Security "max-age=31536000" always; ssl_certificate /etc/letsencrypt/live/grafana.secretbee.buzz/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/grafana.secretbee.buzz/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; location / { proxy_set_header Host $host; proxy_pass http://localhost:4000; } location /api/live/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_pass http://localhost:4000; } }