Hint: proxy_pass sets backend URL to avoid 502 [OK]
Common Mistakes:
Using listen instead of proxy_pass for backend
Confusing server_name with backend address
Setting root instead of proxy_pass for proxying
3. Given this nginx error log snippet: connect() failed (111: Connection refused) while connecting to upstream What is the most likely cause of the 502 error?
medium
A. nginx has insufficient permissions to read files
B. nginx configuration syntax error
C. Backend server is not running or not accepting connections
D. DNS resolution failure for backend server
Solution
Step 1: Interpret the error message
"Connection refused" means nginx tried to connect but backend server refused, likely because it is down or not listening.
Step 2: Rule out other causes
Syntax errors cause config reload failures, permissions affect file access, DNS failure shows different errors.
Final Answer:
Backend server is not running or not accepting connections -> Option C
Quick Check:
Connection refused = backend down [OK]
Hint: Connection refused means backend server is down [OK]
Common Mistakes:
Assuming syntax error from connection refused
Blaming nginx file permissions
Thinking DNS failure causes connection refused
4. You see a 502 error in nginx logs caused by upstream timed out. Which fix is most appropriate?
medium
A. Clear browser cache and cookies
B. Increase proxy_read_timeout in nginx config
C. Change server_name directive
D. Restart nginx service immediately
Solution
Step 1: Understand the timeout error
"upstream timed out" means nginx waited too long for backend response.
Step 2: Adjust nginx timeout settings
Increasing proxy_read_timeout lets nginx wait longer before giving 502 error.
Final Answer:
Increase proxy_read_timeout in nginx config -> Option B
Quick Check:
Timeout error fixed by increasing proxy_read_timeout [OK]
Hint: Increase proxy_read_timeout to fix upstream timeout [OK]
Common Mistakes:
Restarting nginx without config change
Changing server_name unrelated to timeout
Clearing browser cache won't fix backend timeout
5. You fixed a backend server crash causing 502 errors. What is the correct next step to apply nginx changes and confirm the fix?
hard
A. Reload or restart nginx and check error logs for 502 errors
B. Clear browser cache and refresh the page
C. Edit nginx config to change server_name
D. Delete nginx access logs to free space
Solution
Step 1: Apply nginx configuration and backend fixes
After fixing backend, reload or restart nginx to apply any config changes and reset connections.
Step 2: Verify fix by checking logs
Check nginx error logs to confirm 502 errors no longer appear, ensuring the problem is solved.
Final Answer:
Reload or restart nginx and check error logs for 502 errors -> Option A
Quick Check:
Reload nginx and check logs to confirm fix [OK]
Hint: Reload nginx and check logs after backend fix [OK]
Common Mistakes:
Only clearing browser cache without server reload
Changing unrelated config like server_name
Deleting logs instead of reading them
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.