“unknown directive” after a config change usually means the module is not compiled into this nginx build.
nginx -V 2>&1 | tr ' ' '\n' | grep -- --with-
Capital -V prints the version, the compiler and the configure arguments, and it writes to standard error, which is why the example adds 2>&1. Look for flags such as --with-http_v2_module or --with-http_realip_module. Lowercase -v only prints the version. Distro packages, the nginx.org packages and Docker images are built with different module sets, so check on the machine you deploy to, not on your laptop. A directive from a module that is missing stops nginx from starting at all.
Further reading: nginx command-line parameters
Going deeper: 🛜 Guide: AdGuard Home + Tailscale (Secure Split-Horizon DNS)