Lets make http://minigames.your-domain.tld have an SSL certificate and repoint all HTTP traffic to HTTPS
sudo apt install certbot
Now we can run CertBot
sudo certbot certonly
Select option 2. In the next few steps it will want to know the webroot of our application since it wil put a temporary file into the folder and try and retrieve it using the domain name. This is to very that we control this server and domain name.
The web root folder will be the root folder that our nodejs server is serving to the browser client. According to my setup, that will be /var/www/minigames/dist/client/
If you domain name hasn't fully propagated across the internet yet, then Certbot will not be able to validate your request with your IP and you will need to try again in an hour or so.
You should see a message indicating that the certificate was issued. It will also indicate the folder where Certbot saved your new certificate keys.
Replace your Nginx minigames.conf with the script below, while also updating the folder location of the ssl_certificate and ssl_certificate_key properties below to match those given to you by Certbot.
Also replace occurrences of YOUR-DOMAIN-NAME with your actual domain name that you received the certificates for.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Now visit https://minigames.your-domain.tld
or visit mine to see a working example