Host more than one nodejs backend under one domain

January 15, 2018 546 views
Nginx Node.js API Ubuntu 16.04

Please I need help. I currently have a nodejs backend server up and running. How can I host another nodejs backend server under thesame domain name

1 Answer

You mentioned that you want to host both under the same domain name. How do you want that to work? Different paths, as in website.com/backend1 and website.com/backend2? A more straightforward way would be backend1.website.com and backend2.website.com. In that case, you can duplicate your existing Nginx server block, update server_name to point to the new sub domain (make sure you configure DNS for the sub domain), and change the proxy_pass port to a different one that your second backend will be using.

Have another answer? Share your knowledge.