Nginx from Zero to a Working Reverse Proxy, with Brew and Self-Signed SSL
Most developers encounter Nginx only when something breaks or when a project needs to go live. Knowing the exact path differences a Homebrew install introduces, the trailing-slash requirement on `proxy_pass`, and how to generate a local trusted certificate removes the friction that otherwise sends people down hours of search-engine detours.
Nginx is the default front door for most web projects, but its official documentation buries the practical details beginners need. This walkthrough starts with the correct pronunciation ("engine x") and moves straight into installation on macOS via Homebrew, where the default port shifts to 8080 and the config directory becomes `servers` instead of `conf.d`. Mixing `brew services` and native `nginx` commands for start/stop creates a "Bootstrap failed: 5" error, so picking one method and sticking with it avoids a reinstall.
The configuration section skips theory and builds two real server blocks: one for static hosting with `try_files` for SPAs, and one that proxies an entire site from a CDN origin. A critical detail is that `proxy_pass` to an upstream must end with a trailing slash or Nginx returns 404s. The guide then layers on local HTTPS by generating a self-signed certificate with `openssl` and configuring a 301 redirect from port 80 to 443, along with the browser trust workarounds needed for local dev.
A reference table of 22 built-in Nginx variables and a one-liner shell command to extract all configured `server_name` values from a running instance close out the piece, giving developers a quick way to audit which domains a machine is handling.
The Homebrew Nginx package changes three defaults (port, docroot, sub-config directory) that are undocumented in Nginx's own manuals, so a developer moving between macOS and Linux will hit silent mismatches.
Nginx's `proxy_pass` trailing-slash behavior is a classic footgun: omitting it replaces the matched location path instead of appending to it, which breaks CDN-proxied SPAs in a way that looks like a routing bug.
Self-signed certificates are treated as a toy, but combined with a 301 redirect and browser trust overrides, they replicate a production HTTPS pipeline closely enough to catch mixed-content and CORS issues before deployment.