Nginx

Nginx is still the most common way to self-host a static site, and it is fast and frugal at it. It also has a few configuration traps that matter more for static sites than anything else: add_header directives that silently stop applying in nested locations, try_files patterns copied from single-page apps that turn every missing page into a soft 404, and on-the-fly compression doing work a build could do once.

The guides below cover a production configuration end to end: caching headers per file type, precompressed Brotli and gzip served with the static modules, a small unprivileged container image for container platforms, and a measured comparison with Caddy for teams deciding between the two.

Layers of a production Nginx configuration for a static site Four layers. URL mapping with try_files and a real 404. Caching headers per file type, repeated in each location. Precompressed Brotli and gzip files served by the static modules. TLS and security headers. What an Nginx static site configuration covers URL mapping try_files + real 404 no SPA fallback Caching headers per file type repeated per location Precompression brotli_static, gzip_static built once TLS and security certificates, headers or Caddy instead
Each layer has its own guide below.

Core Web Vitals Optimization for SSGs

Number of nginx guides of each kind Vertical bars: How-tos 6, Fixes 0, Comparisons 1 and Concepts 0. nginx guides by kind 6 How-tos 0 Fixes 1 Comparisons 0 Concepts
7 guides use nginx in depth; each is listed below under the section it belongs to.

Production-Ready Deployment & CI/CD for SSGs

Topics with the most nginx guides Horizontal bars, largest first: Self-Hosting Static Sites on S3, Nginx and Caddy 5, CSS and JavaScript Asset Optimization 1 and CDN Caching Rules for SSGs 1. Where nginx comes up Self-Hosting Static Sites on S3, Nginx… 5 CSS and JavaScript Asset Optimization 1 CDN Caching Rules 1
Topic pages give the wider context for each group; the numbers count only guides that use this tool in depth.

Often used with nginx

  • Caddy3 shared guidesSelf-hosted serving with automatic HTTPS.
  • Eleventy1 shared guidesIncremental builds, image pipelines and the data cascade.
  • Cloudflare1 shared guidesPages and Workers hosting, cache rules and edge functions.