EOF is unquoted => all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \newline is ignored, and ‘\’ must be used to quote the characters ‘\’, ‘$’, and ‘`’.
<nowiki>
cat > /etc/nginx/snippets/letsencrypt.conf << EOF
ssl_certificate /etc/letsencrypt/live/$(hostname)/fullchain.pem;