# Redirect Legacy HTTP -> New HTTPS (gosojorn.com & gojorn.com)
server {
    server_name gosojorn.com api.gosojorn.com gojorn.com www.gojorn.com;
    listen 80;
    return 301 https://sojorn.net$request_uri;
}

# Redirect Legacy HTTPS -> New HTTPS (gosojorn.com ONLY)
# We can only serve SSL for domains we have certs for (gosojorn)
server {
    server_name gosojorn.com;
    listen 443 ssl;
    
    # Use EXISTING legacy certificates
    ssl_certificate /etc/letsencrypt/live/gosojorn.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/gosojorn.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf; 
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; 

    return 301 https://sojorn.net$request_uri;
}

server {
    server_name api.gosojorn.com;
    listen 443 ssl;
    
    # Use EXISTING legacy certificates
    ssl_certificate /etc/letsencrypt/live/api.gosojorn.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/api.gosojorn.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    return 301 https://api.sojorn.net$request_uri;
}
