Reverse proxy essentials
A reverse proxy must pass the original host and client address to the app (Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto), or the app will build wrong links and log every visitor as 127.0.0.1. WebSocket apps also need the Upgrade and Connection headers and HTTP/1.1 to the upstream.
Always run nginx -t before reloading: a typo stops the reload but leaves the old configuration serving, while a restart with a bad file takes every site down.