Nodejs and Apache in the same doplet

November 9, 2016 196 views
Apache Node.js Ubuntu 16.04

First of all: Congratulations boys, you have an incredible service.

Hi, i have got severals wordpress blogs in my droplet, each with it own domain, f.e: toracoslabs.com

Now the problem is that i want to start a big project, with node.js and express, and i prefer to have a big droplet than many of 5$. I bought the domain ToracosLabsArena.me and i want to point with it my node.js app running in port 80.

How can i do that? if you need more details please ask.

Thanks for the help, ToracosLabs.

1 Answer

Hi!
I'm glad you like DigitalOcean. :)

Yes this is possible. Usual set up is to run Node app on non 80 ports (for example 8080, 3000, you can use any greeter than 1024) and make reverse proxy with Nginx or Apache to port 80.
This is done because to run something on port less than 1024 you need to run it with with root privileges. That's why you usually want to run it on any port greeter than 1024 then use reverse proxy to make it work on 80.

DigitalOcean covered you for Node.js + Nginx in How To Set Up a Node.js Application for Production on Ubuntu 16.04.
About Apache, I think there is no direct tutorial for Node.js but How to Set Up Apache Traffic Server as a Reverse-Proxy on Ubuntu 14.04. It is for Ubuntu 14.04 but is also relevant for 16.04.
I really recommend to read Nginx one also, it's great one. Pay attention to pm2 part, it's Nodejs service management plug in that will help a lot.

If you got any question, feel free to ask, I'll or somebody other will try to give you answer. :)

Apache Traffic Server is a highly scalable caching proxy server capable of handling large volumes of concurrent requests while maintaining a very low latency. This tutorial will cover how to install Apache Traffic Server on Ubuntu 14.04 and configure it to behave as a caching reverse proxy.
Have another answer? Share your knowledge.