nginx -t checks the config that is already in place. For a bigger change, I’d test it before it goes into /etc/nginx at all.
sudo nginx -t -c /tmp/stage/nginx.conf
sudo nginx -t -q -c /tmp/stage/nginx.conf && echo "safe to copy"
-c points nginx at a different main config file, and -t only tests it, so nothing reloads. Errors come back with the file and line number, like unknown directive "bogus_directive" in /tmp/stage/nginx.conf:10. -q hides the success messages, which keeps a deploy script quiet unless something is wrong.
Relative include paths are resolved against the directory of the file you pass with -c. include conf.d/*.conf; in /tmp/stage/nginx.conf then reads /tmp/stage/conf.d/, and the check fails until mime.types is there too. That makes a full staged copy easy: copy the whole /etc/nginx folder, edit it, test it. Absolute include paths still point at the live files, so check them.
The test also opens the log files and certificates the config names, which is why it needs sudo. A pass means the syntax and files are fine, not that the routing does what you meant. Add -T to print the full merged config and read the part you changed.
Further reading: nginx command-line parameters
Going deeper: 🛜 Guide: AdGuard Home + Tailscale (Secure Split-Horizon DNS)