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

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.

×
1 answer

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:
  • 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

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.
Submit an Answer