daemon off; # run in the foreground so supervisord can look after it

worker_processes 4;
pid $${directory:run}/nginx.pid;

events {
  worker_connections 768;
  # multi_accept on;
}

error_log $${nginx-configuration:error_log};

http {  
  
  ##
  # Basic Settings
  ##
  
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  server_tokens off;

  # server_names_hash_bucket_size 64;
  # server_name_in_redirect off;

  default_type application/octet-stream;
  include ${nginx-output:mime};

  ##
  # Logging Settings
  ##
  
  access_log $${nginx-configuration:access_log};
  error_log $${nginx-configuration:error_log};

  ##
  # Gzip Settings
  ##
  
  gzip on;
  gzip_disable "msie6";

  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

server {
  listen [$${nginx-configuration:ip}]:$${nginx-configuration:port};

  ssl                 on;
  ssl_certificate $${nginx-configuration:ssl_crt};
  ssl_certificate_key $${nginx-configuration:ssl_key};

  fastcgi_temp_path  $${directory:varnginx} 1 2;
  uwsgi_temp_path  $${directory:varnginx} 1 2;
  scgi_temp_path  $${directory:varnginx} 1 2;

  client_body_temp_path $${directory:varnginx} 1 2;
  proxy_temp_path $${directory:varnginx} 1 2;

  ## Only allow GET and HEAD request methods
  if ($request_method !~ ^(GET|HEAD)$ ) {
     return 444;
  }

  ## Serve an error 204 (No Content) for favicon.ico
  location = /favicon.ico {
    return 204;
  }
  location /
  {   
      root $${directory:www};
#       index index.html;
  }
}

}

