Ubuntu – How to run Apache Tomcat and Node.JS servers at the same time

amazon ec2node.jsserver-setuptomcatUbuntu

I'll give you an example of what I want: Let's pretend my domain is domain.com for now. My server machine is a Linux (Ubuntu). I'm currently running Tomcat as my server on ports 80 and 8080. I have Node.JS installed, and I have a Node app. If I run the app on port 3000, and use curl localhost:3000, I get my code. But if I launch domain.com:3000, Chrome just says "connecting", and eventually fails to 'connect', though port 80 and 8080 still work. I even tried stopping tomcat, and running Node, but still same results. How can I run Apache Tomcat server and NodeJS on different ports, for a domain?

Note: I have root/admin SSH access to the Ubuntu server machine, although no physical access. It is an Amazon AWS EC2 Machine.

Best Answer

This could be one or more of several things, I'd go for

  • You may not have opened port 3000 in you EC2 Security Group.
  • You may not have configured your node.js to listen on your external address.
  • You may not have opened port 3000 in your instance firewall.