A heredoc expands variables and command substitutions by default, which is convenient for a template and disastrous for anything containing a dollar sign belonging to another language.
# expands ${DOMAIN} — usually what you want
cat > site.conf <<CONF
server_name ${DOMAIN};
CONF
# quoted delimiter: NOTHING expands. for nginx, for scripts.
cat > site.conf <<'CONF'
location / { try_files $uri $uri/ /index.php?$query_string; }
CONF
One apostrophe changes every line of the body and the difference is invisible in a diff. The failure is a generated nginx config where $uri and $query_string have been replaced with empty strings, which produces a server that starts and serves the wrong thing. <<- with a leading dash strips leading tabs only and not spaces, which is why indented heredocs so often do not behave as expected.