Multiple Servers access using a single public IP

November 27, 2017 247 views
Nginx Ubuntu

I am just new to Nginx and keen to learn about Nginx max. features. 1st of all I want to learn from the scratch. How to configure Ntinx SSL redirects for multiple DNS records using a single public IP such as I've a single Public IP and I want to redirect as following.

Suppose I've a domain name with Public IP to my Private IP to my Private IP to my Private IP 192.168,1,120

I simply need to re-route any request for http and https to redirect to HTTPS protocol from a sing Public IP assigned to multiple sub domains to Nginx and Nginx to my Serves with above defined servers.

Best Regards

1 Answer

What you are referring to is a basically load balancing but there are few things to consider, such as preserving state between the different web servers handling the requests, how they establish connections and also ensure that if a user needs to hit the same web server again, that they are directed there.

While you can set this up with Nginx, you probably want to setup a server that is running a load balancer, such as HAproxy instead and then redirect from.

Additionally in load balancer setups you really want to have two servers acting as your load balancer so that if one fails the other takes over.

I would recommend that you read documentation on how to setup load balancing if you want to build this from scratch and look into HAProxy.

Outside of that you can also use the load balancer feature inside of DigitalOcean to basically set this up for you without the need to maintain the load balancers yourself and you can also specify which specific servers you want the requests sent to.

Have another answer? Share your knowledge.