Created
December 5, 2024 08:22
-
-
Save twolodzko/cbbe037c277443167fd40e12afc19f70 to your computer and use it in GitHub Desktop.
Grafana with Nginx reverse proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
grafana: | |
image: grafana/grafana | |
container_name: grafana | |
restart: unless-stopped | |
ports: | |
- '3000:3000' | |
networks: | |
- network | |
nginx: | |
image: nginx:latest | |
container_name: nginx | |
volumes: | |
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro | |
- ./index.html:/usr/share/nginx/html/index.html | |
ports: | |
- '80:80' | |
networks: | |
- network | |
networks: | |
network: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello, World! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NGINX config based on this tutorial: | |
# https://grafana.com/tutorials/run-grafana-behind-a-proxy/ | |
# This is required to proxy Grafana Live WebSocket connections. | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
listen 80; | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
location /grafana { | |
proxy_set_header Host $host; | |
proxy_pass http://grafana:3000; | |
rewrite ^/grafana/(.*) /$1 break; | |
} | |
# Proxy Grafana Live WebSocket connections. | |
location /grafana/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://grafana:3000; | |
rewrite ^/grafana/(.*) /$1 break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment