apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config--boost
data:
  default.conf: |-

    server {
      listen 80;
      server_name {{.Values.publicFqdn}};
      return 301 $scheme://www.{{.Values.publicFqdn}}$request_uri;
    }

    server {
      listen 80 deferred default;
      server_name www.{{.Values.publicFqdn}};

      error_log /dev/stdout info;
      access_log /dev/stdout main;

      proxy_set_header        Host            $host;
      proxy_set_header        X-Real-IP       $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
      client_max_body_size    {{.Values.clientMaxBodySize|quote}};
      client_body_buffer_size 128k;
      proxy_connect_timeout   90;
      proxy_send_timeout      90;
      proxy_read_timeout      90;
      proxy_buffers           16 100k;

      proxy_redirect off;

      location / {
          proxy_pass http://unix:/run/gunicorn.sock;
      }

      location /static {
        alias /code/static_deploy;
        expires 7d;
      }

      location /media {
        alias /code/media;
        expires 1d;
      }

      include /etc/nginx/mime.types;
    }
