By Faisal Raza
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 example.com with Public IP 123.45.67.8
app1.example.com to my Private IP 192.168.1.100 app2.example.com to my Private IP 192.168.1.110 aap3.example.com 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
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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.