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

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name zulip.org;

    ssl_certificate /etc/letsencrypt/live/zulip.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/zulip.org/privkey.pem;

    location /dist/ {
        autoindex on;
        alias /home/zulip/dist/;
    }

    location / {
        rewrite ^/ https://zulip.com permanent;
    }
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name blog.zulip.org;

    ssl_certificate /etc/letsencrypt/live/zulip.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/zulip.org/privkey.pem;

    location / {
        rewrite ^/(.*)$ https://blog.zulip.com/$1 permanent;
    }
}
