Blue-green deployment is a technique where two identical environments (blue and green) run different versions of an application. Traffic is switched between them to deploy updates with minimal downtime.
Click to reveal answer
beginner
How does NGINX help in blue-green deployment routing?
NGINX acts as a reverse proxy that routes user traffic to either the blue or green environment based on configuration, enabling smooth switching between versions.
Click to reveal answer
beginner
What is the main benefit of blue-green deployment routing?
It reduces downtime and risk by allowing quick rollback to the previous version if the new version has issues.
Click to reveal answer
intermediate
Show a simple NGINX snippet to route traffic to the blue environment.
server {
listen 80;
location / {
proxy_pass http://blue_backend;
}
}
This routes all traffic to the blue environment backend.
Click to reveal answer
intermediate
What must you update in NGINX to switch traffic from blue to green?
You update the proxy_pass directive to point from the blue backend to the green backend, then reload NGINX to apply the change.
Click to reveal answer
What does blue-green deployment aim to minimize?
AUser interface changes
BCode complexity
CDowntime during deployment
DNumber of servers
✗ Incorrect
Blue-green deployment minimizes downtime by switching traffic between two environments.
In NGINX, which directive is used to route traffic to a backend server?
Aproxy_pass
Blisten
Cserver_name
Dlocation
✗ Incorrect
The proxy_pass directive forwards requests to the specified backend server.
What is the purpose of having two environments in blue-green deployment?
ATo test different features simultaneously
BTo reduce server costs
CTo increase database speed
DTo allow seamless switching between versions
✗ Incorrect
Two environments allow switching traffic smoothly between versions.
How do you apply changes after updating NGINX configuration for blue-green routing?
ARestart the server hardware
BReload NGINX
CClear browser cache
DUpdate DNS records
✗ Incorrect
Reloading NGINX applies configuration changes without downtime.
Which environment is usually live before switching in blue-green deployment?
ABlue
BGreen
CBoth at the same time
DNeither
✗ Incorrect
Typically, the blue environment is live before switching to green.
Explain how NGINX can be configured to switch traffic between blue and green environments in a blue-green deployment.
Think about how NGINX forwards requests and how changing the proxy_pass target affects traffic.
You got /4 concepts.
Describe the main advantages of using blue-green deployment routing in production environments.
Consider what problems blue-green deployment solves compared to direct updates.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using blue-green deployment routing with Nginx?
easy
A. To encrypt traffic between client and server
B. To increase the number of servers in the cluster
C. To cache static files for faster loading
D. To switch traffic between two app versions without downtime
Solution
Step 1: Understand blue-green deployment concept
Blue-green deployment uses two versions of an app (blue and green) to switch traffic smoothly.
Step 2: Identify Nginx role in routing
Nginx switches traffic by changing proxy_pass between blue and green upstreams, avoiding downtime.
Final Answer:
To switch traffic between two app versions without downtime -> Option D
Quick Check:
Blue-green routing = traffic switch without downtime [OK]
Hint: Blue-green means two versions, switch traffic smoothly [OK]
Common Mistakes:
Confusing blue-green with load balancing
Thinking it increases server count automatically
Assuming it handles encryption or caching
2. Which Nginx directive is used to switch traffic between blue and green app versions in blue-green deployment?
easy
A. proxy_pass
B. listen
C. server_name
D. root
Solution
Step 1: Identify directive for routing requests
The proxy_pass directive tells Nginx where to send incoming requests.
Step 2: Understand blue-green switching
Switching proxy_pass between blue and green upstream blocks changes the app version served.
Final Answer:
proxy_pass -> Option A
Quick Check:
proxy_pass switches traffic in blue-green [OK]
Hint: proxy_pass directs traffic to app versions [OK]
Common Mistakes:
Using listen to switch app versions
Confusing server_name with routing
Using root which sets document root, not proxy
3. Given this Nginx config snippet, what backend will receive traffic?
upstream blue {
server 10.0.0.1:8080;
}
upstream green {
server 10.0.0.2:8080;
}
server {
listen 80;
location / {
proxy_pass http://green;
}
}
medium
A. 10.0.0.1:8080 (blue)
B. 10.0.0.2:8080 (green)
C. Both blue and green servers
D. No backend, config error
Solution
Step 1: Check proxy_pass target
The proxy_pass points to http://green, so traffic goes to green upstream.
Step 2: Identify green upstream server
Green upstream has server 10.0.0.2:8080, so this server receives traffic.
Final Answer:
10.0.0.2:8080 (green) -> Option B
Quick Check:
proxy_pass to green = 10.0.0.2:8080 [OK]
Hint: proxy_pass target = backend server [OK]
Common Mistakes:
Assuming traffic goes to blue by default
Thinking both upstreams get traffic simultaneously
Believing config has syntax errors
4. Identify the error in this Nginx blue-green deployment config snippet:
upstream blue {
server 10.0.0.1:8080;
}
upstream green {
server 10.0.0.2:8080
}
server {
listen 80;
location / {
proxy_pass http://blue;
}
}
medium
A. Missing semicolon after green server line
B. proxy_pass should use https instead of http
C. listen directive must specify IP address
D. upstream block names must be uppercase
Solution
Step 1: Check upstream block syntax
The green upstream server line lacks a semicolon at the end, causing syntax error.
Step 2: Validate other directives
proxy_pass with http is valid; listen can omit IP; upstream names can be lowercase.
Final Answer:
Missing semicolon after green server line -> Option A
Quick Check:
Missing semicolon causes config error [OK]
Hint: Check semicolons after each directive line [OK]
Common Mistakes:
Assuming http must be https in proxy_pass
Thinking listen needs IP address
Believing upstream names must be uppercase
5. You want to switch live traffic from blue to green app version with zero downtime using Nginx. Which is the best approach?
hard
A. Stop blue servers and start green servers without changing Nginx
B. Change DNS to point to green servers and wait for propagation
C. Change proxy_pass in Nginx config from blue to green and reload Nginx
D. Restart Nginx without changing config to refresh connections
Solution
Step 1: Understand zero downtime switch
Changing proxy_pass in Nginx config directs traffic to green without downtime.
Step 2: Reload Nginx to apply changes
Reloading Nginx applies new config smoothly without dropping connections.
Final Answer:
Change proxy_pass in Nginx config from blue to green and reload Nginx -> Option C
Quick Check:
proxy_pass switch + reload = zero downtime [OK]
Hint: Switch proxy_pass and reload Nginx for smooth update [OK]
Common Mistakes:
Stopping blue servers causes downtime
Relying on DNS changes delays switch
Restarting Nginx without config change does nothing
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.