#worker_process 2;
user huginn huginn;

events { 
  worker_connections 1024;
  accept_mutex on;
}

http {
  upstream huginn_server {
    server unix:/home/huginn/shared/tmp/sockets/unicorn.sock;
}

  server {
    listen 80;
    server_name _;
    keepalive_timeout 5;
    root /home/huginn/current/public;
    try_files $uri/index.html $uri.html $uri @app;
    error_page 500 502 503 504 /500.html;
    location = /500.html {
      root /home/huginn/current/public;
    }
    location @app {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_set_header Host $http_host;

      proxy_redirect off;

      proxy_pass http://huginn_server;
    }
}
}

