Question

Set up nginx with multiple domains and node process

As I was following this tutorial: https://www.digitalocean.com/community/questions/setting-up-multiple-nodejs-applications-using-nginx-vitual-hosts

It doesn’t seem to work, as when i completed all steps and went to the sub domain it says this site cannot be reached, but if i just go to the ip it just shows this: https://imgur.com/a/CeY6iiu

Subscribe
Share

Submit an 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 there @selll,

I would recommend following the steps from this tutorial here instead:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04#set-up-nginx-as-a-reverse-proxy-server

Then once you want to start a second Node.js application keep the following things in mind:

  • Make sure that you use a different port for each application
  • Make a copy of the /etc/nginx/sites-available/default to /etc/nginx/sites-available/example2.conf and adjust the values there to match your second application
  • Then enable the second site:
  1. ln -s /etc/nginx/sites-available/example2.conf /etc/nginx/sites-example/example2.conf

Finally, restart Nginx as explained in the tutorial.

Let me know how it goes. Regards, Bobby