daemon off;
events {
    worker_connections 4000;
}
error_log {{error_log}};
http {
    {{#temp_path}}
    client_body_temp_path {{temp_path}}/nginx_temp_body;
    proxy_temp_path {{temp_path}}/nginx_temp_proxy;
    fastcgi_temp_path {{temp_path}}/nginx_temp_fastcgi;
    uwsgi_temp_path {{temp_path}}/nginx_temp_uwsgi;
    scgi_temp_path {{temp_path}}/nginx_temp_scgi;
    {{/temp_path}}
    server_names_hash_bucket_size 64;
    include {{mimePath}};
    default_type application/octet-stream;
    log_format main '$remote_addr - $remote_user [$time_local] $status '
                  '"$request" $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "http_x_forwarded_for"';
    sendfile on;
    tcp_nopush on;
    tcp_nodelay off;
    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_proxied any;
    access_log {{access_log}};
    error_log {{error_log}};
    {{#upstream}}
    upstream {{name}} {
      {{method}};
      {{#routes}}
      server {{host}}:{{port}};
      {{/routes}}
    }
    {{/upstream}}
    server {
      listen 7005 default_server;
      location =/health {
        return 200;
        access_log off;
      }
      location ~* {
        return 404;
      }
    }
    {{#server}}
    server {
      {{#maintenance}}
      return 503;
      {{/maintenance}}
      {{#directives}}
      {{directive}};
      {{/directives}}
      listen 7005;
      server_name {{domain}};
      client_max_body_size {{client_max_body_size}};
      location / {
        proxy_pass http://{{name}};
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        {{#location_arguments}}
        {{argument}};
        {{/location_arguments}}
      }
    }
    {{/server}}
}
worker_processes {{worker_processes}};
pid {{pidfile}};
