server {
    listen 80;
    listen [::]:80;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    ssl_certificate /etc/ssl/certs/zulip.combined-chain.crt;
    ssl_certificate_key /etc/ssl/private/zulip.key;

    location / {
        proxy_set_header Connection "";
        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;

        proxy_pass          http://127.0.0.1:9991;
        proxy_read_timeout  1200;

        proxy_redirect off;
        proxy_next_upstream off;
    }
}
