# Generated by nginxconfig.io
# https://www.digitalocean.com/community/tools/nginx?domains.0.server.domain=localhost&domains.0.server.documentRoot=%2Fusr%2Fshare%2Fnginx%2Fhtml&domains.0.server.cdnSubdomain=true&domains.0.https.https=false&domains.0.php.php=false&domains.0.routing.index=index.html&domains.0.routing.fallbackHtml=true&domains.0.routing.fallbackPhp=false&global.performance.assetsExpiration=1d&global.performance.mediaExpiration=1d&global.performance.svgExpiration=1d&global.performance.fontsExpiration=1d&global.logging.accessLog=%2Fdev%2Fstdout&global.logging.errorLog=%2Fdev%2Fstderr%20warn&global.logging.logNotFound=true&global.nginx.user=nginx&global.nginx.pid=%2Fvar%2Frun%2Fnginx.pid&global.nginx.clientMaxBodySize=50&global.docker.dockerfile=true&global.tools.modularizedStructure=false&global.tools.symlinkVhost=false
# and then edited manually ;)

pid                  /tmp/nginx.pid;
worker_processes     auto;

events {
  multi_accept       on;
  worker_connections  1024;
}

http {
  charset                utf-8;
  sendfile               on;
  tcp_nopush             on;
  tcp_nodelay            on;
  server_tokens          off;
  types_hash_max_size    2048;
  types_hash_bucket_size 64;

  # rootless
  client_body_temp_path /tmp/client_temp;
  proxy_temp_path       /tmp/proxy_temp_path;
  fastcgi_temp_path     /tmp/fastcgi_temp;
  uwsgi_temp_path       /tmp/uwsgi_temp;
  scgi_temp_path        /tmp/scgi_temp;

  # MIME
  include                mime.types;
  default_type           application/octet-stream;
  types {
    application/manifest+json webmanifest;
  }

  # Logging
  log_format json escape=json
    '{'
      '"bytes_sent": "$bytes_sent",'
      '"http_user_agent": "$http_user_agent",'
      '"nginx_version": "$nginx_version",'
      '"query_string": "$query_string",'
      '"realip_remote_addr": "$realip_remote_addr",'
      '"remote_addr": "$remote_addr",'
      '"remote_user": "$remote_user",'
      '"request_length": "$request_length",'
      '"request_method": "$request_method",'
      '"request_time": "$request_time",'
      '"server_addr": "$server_addr",'
      '"server_port": "$server_port",'
      '"server_protocol": "$server_protocol",'
      '"status": "$status",'
      '"time_local": "$time_local",'
      '"uri": "$uri"' 
    '}';

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

  access_log             /dev/stdout main;
  error_log              /dev/stderr warn;

  keepalive_timeout  65;

  # compression
  gzip            on;
  gzip_vary       on;
  gzip_proxied    any;
  gzip_comp_level 6;
  gzip_buffers    16 8k;
  gzip_http_version 1.1;
  gzip_min_length 256;
  gzip_types
    text/plain
    text/css
    application/json
    application/x-javascript
    application/javascript
    text/xml
    application/xml
    application/xml+rss
    text/javascript
    application/vnd.ms-fontobject
    application/x-font-ttf
    font/opentype
    image/svg+xml
    image/x-icon
    audio/wav;

  map_hash_max_size 128;
  map_hash_bucket_size 128;

  map $sent_http_content_type $expires {
    default                       off;
    text/css                      max;
    application/javascript        max;
    text/javascript               max;
    application/vnd.ms-fontobject max;
    application/x-font-ttf        max;
    font/opentype                 max;
    font/woff2                    max;
    image/svg+xml                 max;
    image/x-icon                  max;
    audio/wav                     max;
    ~images/                      max;
    ~font/                        max;
  }

  include /etc/nginx/conf.d/*.conf;
}
