Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2012 21:24
Show Gist options
  • Star 46 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save drawks/1830579 to your computer and use it in GitHub Desktop.
Save drawks/1830579 to your computer and use it in GitHub Desktop.
Graphite on uwsgi/nginx
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
server unix:/tmp/uwsgi.sock;
server {
listen 8080;
server_name graphite;
charset utf-8;
# Django admin media.
location /media/admin/ {
alias /usr/lib/python2.7/site-packages/django/contrib/admin/media/;
# Your project's static media.
location /content/ {
alias /usr/share/graphite/webapp/content/;
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include uwsgi_params;
#This is the uwsgi configfile
vacuum = true
master = true
processes = 8
pidfile = /tmp/
socket = /tmp/uwsgi.sock
chmod-socket = 666
gid = www-data
uid = www-data
pythonpath = /usr/share/graphite/webapp
home = /home/drawks/graphite-sb
pymodule-alias = graphite.local_settings=/etc/graphite/
module = wsgi
buffer-size = 65536
#This is the wsgi target that lives under the webapp subdirectory
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Copy link

kbalasun commented Feb 5, 2015

great. Really helpful.

Copy link

vlcty commented Nov 6, 2015

Nice! Thanks

Copy link

great stuff

Copy link

@drawks This file you have mentioned, it doesn't exist in the /opt/graphite/webapp directory, so do I have to add this file exclusively?

Copy link

What is the point of when you are using 1 server? To be honest what is the point to have upstream at all?

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