server {
  listen 80;
  root /opt/graphite/static;
  index index.html;

  location /media {
    # django admin static files
    alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/;
  }

  location /admin/auth/admin {
    alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
  }

  location /admin/auth/user/admin {
    alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
  }

  location / {
    proxy_pass http://localhost:8080;
    proxy_set_header  Host      $host;
    proxy_set_header  X-Real-IP $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;

    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
    add_header 'Access-Control-Allow-Credentials' 'true';
  }

}
