2

I have two servers under the same domain name:

  1. Apache webserver listening to port 80
  2. Node.js server listening to port 8080

What do I need to do in order to run each server on a different ec2 instance? Can I use the AWS load balancer for this?

4
  • 1
    This question is really way too general. Sure you could do that. Are you asking how you setup AWS LB? How you would migrate the configs? Did you already google for how to set this up? Why do they need to be split up? Does the node.js still need to live on port 8080?
    – polynomial
    Aug 24, 2011 at 5:34
  • I'm not sure what you mean by migrate configs. I want to set up two webservers, one handles requests from port 80 while the other from port 8080. I don't know if AWS LB provides this functionality, someone else suggested using the firewall and I am looking into that now. I would like to keep node.js on any port other than 80.
    – Dave
    Aug 24, 2011 at 7:58
  • Why do you want to use 2 machines for this ?
    – user9517
    Aug 24, 2011 at 8:11
  • Since they're largely unrelated infrastructure wise I'd rather separate them for better fault tolerance. The bigger reason is that I expect the load on these two systems to be very different, therefore they should be separated so that the infrastructure can be more efficiently scaled up as load increases on one part or the other.
    – Dave
    Aug 24, 2011 at 19:34

1 Answer 1

0

If you want to keep them under the same domain name, then you'll have to have one server be the "switchboard" and redirect all traffic bound for the server that you moved to whichever instance it's on. The easiest way would be to use iptables (or the firewall of choice on the OS of your choosing) to rewrite all traffic bound to the port of the moved server. If you have a firewall of some kind in front of your instances, then split the traffic up there.

Perhaps the better choice would be to simply use a subdomain DNS entry to send traffic to the new server? webserver.com goes to the Apache server and sub.webserver.com goes to the node.js server?

1
  • I am looking into the firewall approach, thanks. My application is a single page app. The web app and many of the ajax data calls are handled by the apache server. However, I also have a chat module embedded in the web app. The chat server is built on Node. I was under the impression that the 'single origin policy' meant that both servers had to be under the same domain. Am I overthinking this? Can I just split them up into different subdomains and still have everything work fine?
    – Dave
    Aug 24, 2011 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .