Report this

What is the reason for this report?

Deploy react app and node app on separate droplet

Posted on February 4, 2021

Hi

I have created two droplets, one for react app, which I had deployed successfully.

Now I want to deploy node app on another droplet using subdomain concept, as My react droplet is already using domain name with floating ip attached.



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.

Heya,

Deploying a Node.js app on a subdomain is a great idea, and you can follow these steps:

  1. Create an A Record for your subdomain in your domain management system (DNS), pointing it to your second droplet’s IP address.

  2. In the second droplet, install Nginx to serve as a reverse proxy for your Node.js app. You can follow the steps here: How To Install Nginx on Ubuntu 20.04.

  3. Configure Nginx to proxy requests to your Node.js app running on the second droplet by adding a new server block for your subdomain. You can check out this tutorial on setting up a reverse proxy: How To Set Up a Node.js Application for Production on Ubuntu 20.04.

  4. Restart Nginx to apply the configuration changes.

  5. Ensure your Node.js app is running on the second droplet, and it should now be accessible via the subdomain.

Hope that this helps!

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.