Setting up node app with SSL on a DigitalOcean droplet
Published in
2 min readNov 4, 2015
You probably Googled it it and are here! Okey, no more time waste (for MYSELF in future)…
Let’s see how to setup node app with SSL on a DigitalOcean VPS
- Install Heroku for it’s versioning feature
- Git push the app to Heroku
- Setup a drop let
- Generate SSH keys
- Setup git bash for SSH-ing to droplet
- Connect to Droplet using SSH keys
- Install node
- Confirm node installation using
node -v
- Install MongoDB if the app needs to persist data
- Confirm if mongodb is running using the command
sudo systemctl status mongodb
- Setup and configure pm2 to orchestrate the node app
- Confirm pm2 installation using
pm2 -v
- Clone to a location in the server
- Start the node app for first cut testing
- Start node app as a process
- Install nginx
- Make sure that the nginx service is running using command
sudo systemctl status nginx
- Make sure that UFW is enabled
- Setup nginx reverse proxy to the port on which the app is running
- When reverse-proxying nginx server, keep
try_files $uri $uri/ =404;
insidelocation
if absolutely necessary inside/etc/nginx/sites-available/default
- Purchase a domain
- Set up SSL with Let’s Encrypt for the purchased domain
- Keep a backup of default nginx configuration (and all other important stuff) to revert back in case of an earthquack
Notice that we shall use services like heroku’s git feature instead of the globally famous github for version control to keep code closed source.
Originally published at xameeramir.github.io.