server {
    listen 80;
    server_name {{ django_allowed_host | replace(',', ' ')}};
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name {{ django_allowed_host | replace(',', ' ') }};

    ssl_certificate /etc/letsencrypt/live/{{ letsencrypt_domain }}/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/{{ letsencrypt_domain }}/privkey.pem;

    location /static/ {
        alias /var/www/gamearray/static/;
    }

    location / {
        proxy_pass http://127.0.0.1:8888;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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 https;
    }
}