Skills / Engineering / Nginx Configuration

Nginx Configuration

Configure Nginx as a web server, reverse proxy, and load balancer. Covers server and location blocks, TLS termination, HTTP caching, rate limiting, upstream pools, gzip/brotli, and hardened security headers for production traffic.

This skill helps you write and debug production Nginx configuration. It structures server and location blocks, proxies to application backends, terminates TLS with modern ciphers, sets up response caching and rate limiting, balances traffic across upstream pools, and adds security headers (HSTS, CSP, X-Frame-Options). It also covers troubleshooting 502/504 errors, buffer tuning, and zero-downtime reloads.

nginx reverse-proxy load-balancer tls devops

When to use

Use when configuring Nginx as a web server, reverse proxy, or load balancer — server/location blocks, TLS termination, caching, rate limiting, upstream pools, or security headers.

Examples

Reverse proxy with TLS

Terminate SSL and proxy upstream

Write an Nginx server block that terminates TLS on 443 with a Let's Encrypt cert, redirects HTTP to HTTPS, proxies /api to a Node upstream on 127.0.0.1:3000, and adds HSTS and X-Content-Type-Options headers

Rate limiting and caching

Protect and speed up an endpoint

Add an Nginx limit_req zone that caps /login to 5 requests per second per IP with a burst of 10, and cache GET /static responses for 1 hour with proxy_cache

Load balance upstreams

Distribute traffic across app servers

Configure an Nginx upstream block with three backend servers using least_conn balancing, passive health checks via max_fails, and a fallback backup server
Added to wishlist