Last active
December 31, 2015 21:17
-
-
Save giovtorres/bb1b52bea2efee82a9f8 to your computer and use it in GitHub Desktop.
Run Graphite behind uwsgi + nginx in a subpath/subdirectory/non-root path
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
# This is the config I used for nginx to proxy graphite via uwsgi to a non-root path. | |
# | |
# Graphite is a stubborn Django app that must reside at the DocumentRoot level | |
# and is not readily moved to a subpath. | |
# | |
# The following config allows you to reach the graphite composer at | |
# http://HOSTNAME/graphite. The graphite will redirect all URLs back at the top | |
# level, so the remaining locations handle those and pass them back to the | |
# uwsgi server. | |
# | |
# Special attention is required for /metric/find. The browser fetches metrics with | |
# the url: /metrics/find/?_dc=<salt>&query=... | |
# while Grafana (and perhaps others) will fetch a list of available metrics with | |
# the url: /metrics/find?query=* | |
# | |
# Another is /render. Grafana will POST to /render, while the Graphite composer will | |
# GET /render/?target=... | |
# | |
# ** Note: This config might still require some tweaking... | |
# ** Note: This is not a complete nginx config. | |
# ** Note: I am using a proxying to a uwsgi unix socket. You can replace this with | |
# a http socket if you have that configured in uwsgi. | |
# | |
server { | |
listen 80; | |
root /var/www/html; | |
# GRAPHITE - BEGIN | |
location /graphite { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location /browser/header { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location /browser/usergraph { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location /composer { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location /content { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location /metrics/find/ { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location = /metrics/find { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
location /render { | |
include uwsgi_params; | |
uwsgi_pass unix:///run/uwsgi/graphite.sock; | |
} | |
# GRAPHITE - END | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment