bugcy013
5/5/2014 - 12:19 AM

graphite_gunicorn_nginx.conf

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;
        }

    }
}