node.js droplet Subdomain SSL

January 13, 2016 1.2k views
Security Node.js Ubuntu


following setup:
We do have a droplet with node.js (ubuntu) and need to secure it via ssl. Let's say we have the domain - we just using the node.js server for some parts (chat, etc.).

Thus for me the question is, how to achieve that we can use ssl with it. Should we create a subdomain like and direct that subdomain to the ip of our droplet via dns and then buy the certificate for that ?

Some hints would be great, thanks!

Best, Nico

1 Answer


I would recommend setting up nginx as a reverse proxy for your Nodejs application. Take a look at the following tutorial (ignoring anything related to Apache):

If you have Nodejs set up and ready to go, you can skip straight to the Set Up Reverse Proxy Server section. You will want to replace APP_PRIVATE_IP_ADDRESS in nginx's config with

Once you've done that, configure your Nodejs app to listen on or any other port that is unused and over 1024 (make sure you update the nginx config with the new port as well).

To install an SSL certificate, follow this tutorial:

This tutorial will show you how to acquire and install an SSL certificate from a trusted, commercial Certificate Authority (CA). SSL certificates allow web servers to encrypt their traffic, and also offer a mechanism to validate server identities to their visitors. The...
Have another answer? Share your knowledge.