Report this

What is the reason for this report?

node.js droplet Subdomain SSL

Posted on January 13, 2016
Nico

By Nico

Hi,

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 example.com - 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 services.example.com 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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi,

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 127.0.0.1.

Once you’ve done that, configure your Nodejs app to listen on 127.0.0.1:8080 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:

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.