Nginx Request Routing Mental Model Checklist
Nginx is not just a web server. It is a request router. It receives a request, chooses a server block, matches a location rule, serves a static file or forwards the request to an upstream service such as PHP-FPM or a Docker app.
Core principle
When an Nginx site fails, trace the route: domain, server_name, listen port, root path, location match, try_files, upstream and response. Do not jump straight to WordPress.
Checklist
- Identify the requested domain.
- Check which server block should handle the domain.
- Check listen ports for HTTP and HTTPS.
- Check server_name values.
- Check root or proxy_pass target.
- Check location matching rules.
- Check try_files behavior.
- Check whether request goes to static file, PHP-FPM or proxy upstream.
- Read access and error logs.
- Document the final request route.
Reusable lesson
This applies to WordPress, static sites, APIs, n8n, Docker dashboards, reverse proxy apps, SSL redirects and multi-domain VPS hosting.
When to Use This Checklist
Use this checklist when learning how Nginx routes website requests or debugging wrong site, 404, proxy, SSL or WordPress routing issues.
Required Tools
SSH access, Nginx config, domain, access log, error log, curl, nginx -t
Before You Start
Do not edit multiple Nginx blocks at once. First identify which block is actually handling the request.
Structured Checklist Steps
- Identify domain.
- Find server block.
- Check listen ports.
- Check server_name.
- Check root or proxy target.
- Check location rules.
- Check try_files.
- Check upstream path.
- Read logs.
- Document route.
Verification Steps
- Correct server block is identified.
- Request path is understood.
- nginx -t passes.
- Logs match expected route.
- Website returns expected response.
Rollback Plan
If routing changes break the site, restore the previous server block backup, run nginx -t and reload only after validation passes.
Common Mistakes
- Editing the wrong server block.
- Confusing root with alias.
- Ignoring location precedence.
- Forgetting try_files.
- Not reading access logs.
Related Commands
sudo nginx -T | grep -n "server_name"
sudo nginx -t
curl -I https://example.com
sudo tail -n 100 /var/log/nginx/access.log
sudo tail -n 100 /var/log/nginx/error.log
sudo systemctl reload nginx