Incident response and rollback
Establish scope and collect safe evidence
Start by describing the impact: which routes, users, regions, versions and time window are affected? Assign an incident coordinator, note the last known good change, and choose a low-risk read-only check. Preserve a minimal sanitized timeline and request IDs. Record binary version and build options; configuration dumps may contain private data, so keep them restricted and never paste an entire production dump into a ticket. In an isolated fixture only, check the exact config and prefix.
nginx -vnginx -t -p "$LAB/" -c "$LAB/nginx.conf"Interpret configuration and resource diagnostics
An unknown directive can be a typo, an unavailable module or a version mismatch; a directive not allowed here points to its context. A duplicate virtual host warning may leave a name ignored rather than fail validation. A bind error can indicate an occupied socket or lack of privilege; a file-descriptor error can indicate a process or OS resource ceiling. Check the actual binary, context, listener ownership and resource usage using approved read-only evidence. Do not kill unrelated processes or increase global limits as a first step. The messages below are illustrative categories.
SYNTHETIC: unknown directiveSYNTHETIC: directive is not allowed hereSYNTHETIC: conflicting server nameSYNTHETIC: bind() failedSYNTHETIC: too many open filesMitigate with a small reversible change
If evidence links errors to a recent config change, restore the reviewed known-good revision in the lab, validate it, and reload only the verified lab instance. Nginx can retain the old configuration when reload cannot apply the new one; a syntactically valid but wrong route can still be activated. The following is an illustrative sequence, assuming the lab is already running with an identified PID file. Do not use it against an unknown service. Stop if validation fails.
nginx -t -p "$LAB/" -c "$LAB/nginx.conf" &&nginx -p "$LAB/" -c "$LAB/nginx.conf" -s reloadVerify recovery and record the next action
Check a known working path, an intentionally denied path, a missing path and the affected API; compare status, headers, body and logs. A green syntax check alone cannot confirm correct routing. Monitor the agreed error and latency indicators and keep rollback available until the observation window closes. Document what changed, evidence, uncertainty, owners and follow-up. If TLS or security policy is implicated, repair its configuration without disabling protection. This synthetic acceptance checklist is a handoff, not an executed result.
catalog: 200 and expected contentprivate: 403missing: 404API health: 200error ratio: within agreed thresholdrollback revision: recordedCheck Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Incident response and rollback
Use a scoped incident workflow to interpret Nginx diagnostics, restore a reviewed configuration and verify recovery without weakening security.
What should be captured before a production change?
An unknown directive appears after an upgrade. What should you check?
Does nginx -t guarantee a correct response for every route?
A validated config causes wrong routing after reload. What is a suitable mitigation?
Which recovery check is strongest?