0

I'm trying to understand this and having a hard time. I usually use Ubuntu server, with Apache2, and this time I am not. So I'm a bit out of my element. I'm also a software developer and I don't do much SysAdmin/Devops server stuff. I figured I would post this here, and I'm hoping this is the right place to do it.

===========

I have an AWS EC2, with an AWS Linux AMI (Red Hat) with Apache httpd installed. I have an application load balancer in front of my EC2.

The load balancer is listening on port 80, and so is httpd.

On my EC2, I've started a Node.JS web server and application, which is listening on port 3000.

I have my DNS set up so that my site is public. Let's say its anthony.com.

I am thinking that I can have httpd redirect/forward all of the the inbound requests from anthony.com or anthony.com:80 (implied) to port 3000 so my Node app can handle and serve any requests there.

I'm trying to understand the architecture of this. Does it make sense to have Apache httpd handle these requests? I know that I don't need httpd, but I already installed it and I read in some places that it's good to have a dedicated web server handle all of your traffic before getting to your Node.JS app. Should I just delete apache web server and use Node to handle all of my incoming requests? Or is there a way I can make these two play nice together? Or does it even make sense to have Apache web server on a box with Node?

If I amn going to use Apache web server with Node, how do I forward the ports from 80 to 3000? I know httpd has a conf file; should I do it there (<VirtualHosts>)? Or is this something I should handle in AWS?

I am a software developer, so this is a little murky in terms of Devopsy stuff. How should I structure this?

  • 1
    Until you get to some significant scale, I can't see any reason to have Apache in the loop here. Just let your node.js server run on port 80 and handle its own traffic. At scale, you may want to have another intermediate process handle static files (like CSS, JS and image files), but there's no good reason to start with that extra complication and many would recommend NGINX for that rather than Apache, though Apache will probably work fine too. – jfriend00 Aug 4 '18 at 3:58
  • 1
    @jfriend00 aws application load balancers are already Nginx servers. See my answer. – RubberDuck Aug 4 '18 at 11:33
1

Amazon application load balancers are just NGINX web servers under the hood. Would you put an NGINX instance in front of Apache in front of your Node app? I wouldn’t. You can go directly from your ALB to your Node app.

  • should I have my load balancer listen in port 3000, or my Node app listen on port 80? – aCarella Aug 4 '18 at 20:52
  • Assuming your load balancer is public facing, you want it listening on 80 (& 443 for https). It literally doesn’t matter what port your Node app is running on. This tutorial may help. digitalocean.com/community/tutorials/what-is-load-balancing – RubberDuck Aug 4 '18 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.