Https is port 443, you need to listen on that port including using a certificate for that domain. The config would be something like this
server {
listen 443 ssl http2;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
return 301 https://www.example.com$request_uri;
}
To answer the question in the comment:
- The sites-available folder is for all of the configurations that your server holds
- The sites-enabled folder is for the configurations you want active.
- Typically you create a symbolic link (ln -s) from the sites-enabled folder to the sites-available folder