Chapter

Real-world configs

The capstone chapter: complete, annotated production configs for a static site, a Laravel app, and a Node app, plus a troubleshooting checklist.

Nginx Basics 4 Lessons from courses

About this chapter

Everything from the earlier chapters comes together here. You'll read four complete, working configs line by line: a static HTTPS site, a full Laravel stack, a Node app behind a reverse proxy, and a checklist for when things break.

Lessons from courses

  1. 1 A full static site with HTTPS A complete, annotated nginx server block for a static site: HTTP to HTTPS redirect, root, gzip, asset caching, and a custom 404. Every line explained.
  2. 2 The full Laravel production config The full nginx server block for a Laravel app: HTTPS redirect, root public, try_files front controller, PHP-FPM, gzip, caching, and security headers.
  3. 3 A Node app behind nginx A complete nginx reverse proxy config for a Node app on 127.0.0.1:3000: HTTPS, proxy headers, upstream keepalive, and WebSocket upgrade headers.
  4. 4 A troubleshooting checklist Read nginx errors like a pro: fix 502/504, 403, 404, configs that never applied, and redirect loops using nginx -t and the error log. A practical checklist.
Nginx Basics Go to course