Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit 84122e4

Browse files
committed
Update nginx config to route grafana
1 parent 21db93c commit 84122e4

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

assets/nginx.conf

+14-8
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,32 @@ server {
22
listen 5005;
33

44

5-
location /collect {
6-
proxy_pass_request_headers on;
7-
proxy_pass_request_body on;
8-
proxy_pass http://alloy:8027/collect;
9-
proxy_set_header Host $host;
5+
location /grafana {
6+
rewrite ^/grafana(.*)$ $1 break;
7+
proxy_pass http://grafana:3000;
8+
proxy_set_header Host $http_host;
109
proxy_set_header X-Real-IP $remote_addr;
1110
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1211
proxy_set_header X-Forwarded-Proto $scheme;
12+
13+
# Required for Grafana Live WebSocket connections
14+
proxy_http_version 1.1;
15+
proxy_set_header Upgrade $http_upgrade;
16+
proxy_set_header Connection "upgrade";
1317
}
14-
1518

16-
location /grafana {
19+
20+
location /collect {
1721
proxy_pass_request_headers on;
1822
proxy_pass_request_body on;
19-
proxy_pass http://grafana:3000;
23+
proxy_pass http://alloy:8027/collect;
2024
proxy_set_header Host $host;
2125
proxy_set_header X-Real-IP $remote_addr;
2226
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2327
proxy_set_header X-Forwarded-Proto $scheme;
2428
}
29+
30+
2531

2632
location / {
2733
root /usr/share/nginx/html/;

docker-compose-deploy.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ services:
4343
environment:
4444
GF_SECURITY_ADMIN_PASSWORD: "${GF_SECURITY_ADMIN_PASSWORD}"
4545
GF_SECURITY_ADMIN_USER: "${GF_SECURITY_ADMIN_USER}"
46+
GF_SERVER_ROOT_URL: "http://${DOMAIN}/grafana/"
47+
GF_SERVER_SERVE_FROM_SUB_PATH: "true"
48+
# GF_SERVER_DOMAIN: ${DOMAIN}
49+
# GF_SERVER_ENFORCE_DOMAIN: "false"
50+
# GF_SERVER_HTTP_PORT: "3000"
51+
# GF_SERVER_HTTP_ADDR: "0.0.0.0"
4652

4753
loki:
4854
build:

0 commit comments

Comments
 (0)