Skip to content

Instantly share code, notes, and snippets.

Created April 28, 2014 17:32
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
ubuntu 14.04 + graphite + nginx
# goes in /etc/nginx/sites-available & link in ../sites-enabled
upstream graphite {
server unix:///tmp/uwsgi.sock;
server {
listen 9002;
server_name localhost;
access_log /var/log/nginx/graphite-access.log;
error_log /var/log/nginx/graphite-error.log;
root /user/share/graphite/static;
location / {
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, OPTIONS";
add_header Access-Control-Allow-Headers "origin, authorization, accept";
uwsgi_pass graphite;
include /etc/nginx/uwsgi_params;
location /media {
# This makes static media available at the /media/ url. The
# media will continue to be available during site downtime,
# allowing you to use styles and images in your maintenance page.
alias /usr/lib/python2.7/dist-packages/django/contrib/admin/media;
# goes in /etc/uwsgi/apps-available & link in ../apps-enabled
vacuum = true
master = true
processes = 4
pidfile = /tmp/
socket = /tmp/uwsgi.sock
chmod-socket = 666
gid = _graphite
uid = _graphite
chdir = /usr/share/graphite-web
wsgi-file = graphite.wsgi
pymodule-alias = graphite.local_settings=/etc/graphite/
buffer-size = 65536
plugin = python
# install packages
sudo apt-get install graphite-carbon graphite-web python-rrdtool \
python-memcache libapache2-mod-wsgi python-psycopg python-flup \
python-sqlite python-yaml geoip-database-contrib libgdal1 \
nginx-full uwsgi uwsgi-plugin-python
# goes in /etc/default
Copy link

charl commented Mar 16, 2016

root /user/share/graphite/static; from the nginx config file should most likely read root /usr/share/graphite-web/static;.

Copy link

charl commented Mar 16, 2016

Here's an init config file to manage the uwsgi process if anyone else needs one:

# cat /etc/init/uwsgi.conf 
description "uWSGI"

start on runlevel [2345]
start on (net-device-up
          and local-filesystems
          and runlevel [2345]
          and started nginx)
stop on runlevel [06]


env UWSGI=/usr/local/bin/uwsgi
env LOGFILE=/var/log/uwsgi/emperor.log

exec $UWSGI --master --emperor /etc/uwsgi/apps-enabled --die-on-term --logto $LOGFILE```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment