Skip to content

Instantly share code, notes, and snippets.

@bhang
Created June 27, 2012 13:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save bhang/3003978 to your computer and use it in GitHub Desktop.
Save bhang/3003978 to your computer and use it in GitHub Desktop.
nginx Configuration for gunicorn + graphite
worker_processes 1;
user nobody nogroup;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
worker_connections 64;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
upstream app_server {
#server unix:/tmp/gunicorn.sock fail_timeout=0;
# For a TCP configuration:
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
server_name _;
client_max_body_size 64M;
keepalive_timeout 5;
# path for static files
root /opt/graphite/webapp/content;
location /media/ {
# this changes depending on your python version
root /usr/local/lib/python2.7/dist-packages/django/contrib/admin;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 10;
proxy_read_timeout 10;
proxy_pass http://app_server;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment