Multiple Servers access using a single public IP

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 Faisal

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.