Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx-proxy behind a load balancer (AWS ELB for example) #296

Open
chharish opened this issue Dec 13, 2018 · 0 comments
Open

Nginx-proxy behind a load balancer (AWS ELB for example) #296

chharish opened this issue Dec 13, 2018 · 0 comments

Comments

@chharish
Copy link

My apologies if this is something very basic, I'm new to nginx reverse proxy routing.

I would like to add an additional layer around nginx reverse proxy for improving security and to perform load-balancing and to add horizontal scaling. Say, for example, I have two servers running nginx-proxy serving the same docker containers/applications on port 80. I would like to route traffic between both the servers based on CPU load, memory utilization, traffic count, etc.

As of now, I mapped a domain name to server public IP address in the DNS records. Routing takes place within the server and nginx-proxy redirects the domain name to its appropriate application container.
For example:
example1.com -> server1 public IP -> port 80/443 -> nginx-proxy -> app container1
example2.com -> server1 public IP -> port 80/443 -> nginx-proxy -> app container2
... and so on.

Now, I want to add a load balancer for horizontal scaling. Say, for example, I have this nginx proxy server running in AWS. Instead of exposing the server's public IP, I would like to place an Elastic Load Balancer (ELB from AWS) in between open internet and the server and map ELB's IP to the domain name.
The below is the example of what I'm trying to achieve:
example1.com -> ELB public IP -> server1 IP -> port 80/443 -> nginx-proxy -> app container1
example2.com -> ELB Public IP -> server1 IP -> port 80/443 -> nginx-proxy -> app container2
... and so on.

Now, I'm trying to forward the host header/domain name information from ELB to the server. so the server will be able to recognize the domain name example1.com and route to the app container1 accordingly. So the ELB decides where to send the traffic to (server1 or server2) based on the load and nginx-proxy within the server recognizes the domainname to serve the container.

Is there a way to do this when using docker-gen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant