62 lines
1.7 KiB
Plaintext
Executable File
62 lines
1.7 KiB
Plaintext
Executable File
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
upstream grafana_backend {
|
|
server unix:/run/grafana/grafana.sock;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name grafana.local.eax.app;
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
|
|
# SSL
|
|
ssl_certificate /etc/letsencrypt/live/local.eax.app/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/local.eax.app/privkey.pem;
|
|
ssl_trusted_certificate /etc/letsencrypt/live/local.eax.app/chain.pem;
|
|
|
|
# security
|
|
# include nginxconfig.io/security.conf;
|
|
|
|
# restrict methods
|
|
if ($request_method !~ ^(GET|POST|PUT|HEAD|CONNECT|OPTIONS|TRACE|DELETE)$) {
|
|
return '405';
|
|
}
|
|
|
|
# logging
|
|
access_log /var/log/nginx/grafana.local.eax.app.access.log;
|
|
error_log /var/log/nginx/grafana.local.eax.app.error.log warn;
|
|
location / {
|
|
proxy_pass http://grafana_backend/;
|
|
proxy_set_header Host $http_host;
|
|
}
|
|
|
|
location /api/live {
|
|
rewrite ^/(.*) /$1 break;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_set_header Host $http_host;
|
|
proxy_pass http://grafana_backend/;
|
|
}
|
|
# additional config
|
|
#include nginxconfig.io/general.conf;
|
|
}
|
|
|
|
# HTTP redirect
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name grafana.local.eax.app;
|
|
include nginxconfig.io/letsencrypt.conf;
|
|
|
|
location / {
|
|
return 301 https://grafana.local.eax.app$request_uri;
|
|
}
|
|
}
|