UPDATE: Now you can simply install the https util like so in 1 step:
sudo apt install python3-certbot-nginx
Then execute the utility with:
certbot
Note the python3.
End update.
First off all, you need a domain pointing to your VPS to activate SSL.
To setup SSL follow these steps:
-
Install nginx and use the basic template from this repository. Remember to add your domain name in
server_name
otherwise you won't be able to add a SSL certificate. -
Run these commands to install certbot:
sudo add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-nginx
- Setup your nginx server and install the certificate:
sudo service nginx restart
sudo certbot --nginx -d <YOUR-DOMAIN>.com -d www.<YOUR-DOMAIN>.com
-
That's it! You now should have SSL enabled. Remember to setup pm2 to have a node.js server running all the time.
-
To auto-renew the certificates add a cronjob by doing the following:
- Run:
crontab -e
- Then do:
0 12 * * * certbot renew
That will check every day at 12pm and update if necessary. Check this tab generator to verify it: https://crontab.guru/#0_12___*