Question

How to set up multiple https domains for single IP with NodeJS?

Let’s say my domains are:

https://abc.com https://abc.net https://abc123.com

I want all of them to go to the same IP address (Droplet) which is running NodeJS. Basically, the three web sites all have the same content.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @robertEel,

You’ll need to configure Nginx as a reverse proxy for that.

What Nginx does is receives traffic on port 80 and 443 for your domains and depending on their Nginx configuration, redirects them internally to a specified port on which NodeJS is listening.

That’s the basis of it, I know it doesn’t let you know how to configure it actually but this is what the next tutorial is for:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-20-04

Check it out, it helps with installing NodeJS, PM2, configuring and installing Nginx as a reverse proxy server.

You can follow Step 4 of the tutorial multiple times( the configuration part) for your 3 domains. The only thing I would suggest is to change the internal port your Nginx will be redirecting for each domain.

Regards, KFSys