user                 www-data www-data;
error_log            /dev/stderr warn;
pid                  /var/run/nginx.pid;
worker_processes     auto;
worker_rlimit_nofile 8192;

events {
  worker_connections  1024;
}

http {
  limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=20r/s;
  proxy_set_header Host $host;
  charset utf-8;
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  server_tokens off;
  types_hash_max_size 2048;

  # buffering
  client_header_buffer_size 1k;
  client_max_body_size 20M;
  ignore_invalid_headers off;
  proxy_buffering off;

  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

  map $http_upgrade $connection_upgrade {
    default     "upgrade";
  }

  include /etc/nginx/sites-enabled/*;

}