# HTTP server (redirected to HTTPS)
server {
    listen       80;
    server_name  _;
    return 301 https://$host$request_uri;
}

# HTTPS server
server {
    listen 443;
    server_name _;

    if ( $http_host !~* ^(api-pss\.greenelab\.com)$ ) {
        return 444;
    }

    ssl on;
    ssl_certificate     /etc/letsencrypt/live/api-pss.greenelab.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/api-pss.greenelab.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_read_timeout 300;
        proxy_connect_timeout 300;
        proxy_send_timeout 300;
        send_timeout 300;
    }
}
