paint-brush
Setting up node app with SSL on a DigitalOcean dropletby@xameeramir
876 reads
876 reads

Setting up node app with SSL on a DigitalOcean droplet

by Zameer AnsariDecember 24th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

You probably <a href="https://www.google.com/search?q=Setting+up+node+app+with+SSL+on+a+DigitalOcean+droplet" target="_blank">Googled it</a> it and are here! Okey, no more time waste (for MYSELF in future)…

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Setting up node app with SSL on a DigitalOcean droplet
Zameer Ansari HackerNoon profile picture

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

  1. Install Heroku for it’s versioning feature
  2. Git push the app to Heroku
  3. Setup a drop let
  4. Generate SSH keys
  5. Setup git bash for SSH-ing to droplet
  6. Connect to Droplet using SSH keys
  7. Install node
  8. Confirm node installation using node -v
  9. Install MongoDB if the app needs to persist data
  10. Confirm if mongodb is running using the command sudo systemctl status mongodb
  11. Setup and configure pm2 to orchestrate the node app
  12. Confirm pm2 installation using pm2 -v
  13. Clone to a location in the server
  14. Start the node app for first cut testing
  15. Start node app as a process
  16. Install nginx
  17. Make sure that the nginx service is running using command sudo systemctl status nginx
  18. Make sure that UFW is enabled
  19. Setup nginx reverse proxy to the port on which the app is running
  20. When reverse-proxying nginx server, keep try_files $uri $uri/ =404; inside location if absolutely necessary inside /etc/nginx/sites-available/default
  21. Purchase a domain
  22. Set up SSL with Let’s Encrypt for the purchased domain
  23. 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.