server {
    server_name www.reminder-bot.com;

    return 301 $scheme://reminder-bot.com$request_uri;
}

server {
    listen 80;
    server_name reminder-bot.com;

    return 301 https://reminder-bot.com$request_uri;
}

server {
    listen 443 ssl;
    server_name reminder-bot.com;

    ssl_certificate /etc/letsencrypt/live/reminder-bot.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/reminder-bot.com/privkey.pem;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;

    location / {
        proxy_pass http://localhost:18920;
        proxy_redirect off;
        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;
    }

    location /static {
        alias /var/www/reminder-rs/static;
        expires 30d;
    }
}
