server {
    listen {http_port};
    listen [::]:{http_port};
    server_name www.{domain_name};
    
    # Redirect to https
    location / {
        rewrite ^(.*) https://{domain_name}:{https_port}$1 permanent;
    }    

    # letsencrypt
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }
}