When a config file changes and I want to know exactly what, I do not want to read both files. A unified diff shows only the changed lines.
diff -u nginx.conf.bak nginx.conf
The -u option selects unified format. It starts with a two-line header naming both files and their timestamps. Each change then sits in a hunk that begins with a line like @@ -4,6 +4,7 @@. Lines starting with - were removed, lines with + were added, and lines with a space are unchanged context.
The default is three lines of context, and -U 5 changes that to five. Three is the minimum that patch needs to apply a change reliably, so do not go lower when you plan to share the result.
diff -u old.conf new.conf > fix.patch
patch old.conf < fix.patch
The caveat is directories. To compare two folders, add -r, and add -N if you want files that exist on only one side to appear as additions or removals. Without -N they are just reported as being present in one folder. Also, diff exits with 1 when the files differ, which counts as a failure in a script with set -e.
Further reading: GNU diffutils: unified format