Backup servers
📖 Scenario: You manage a website that needs to stay online even if the main server goes down. To do this, you want to set up backup servers using nginx. This way, if the main server is unavailable, nginx will automatically send visitors to a backup server.
🎯 Goal: You will create an nginx configuration that defines a main server and two backup servers. You will configure nginx to try the main server first and use the backups only if the main server is down.
📋 What You'll Learn
Create an nginx upstream block named
backend with one main server and two backup servers.Mark the two backup servers with the
backup parameter.Configure nginx to use the
backend upstream for proxying requests.Print the final nginx configuration to verify the setup.
💡 Why This Matters
🌍 Real World
Websites often need backup servers to stay online during outages. nginx can automatically switch to backup servers to keep the site available.
💼 Career
DevOps engineers and system administrators use nginx upstream and backup servers to build reliable, fault-tolerant web services.
Progress0 / 4 steps