What I got working (edited per StephenHarris comment) is:
domain=aa ; sed s"/\$domain/$domain/" ~/nginx_app >> ${domain}.conf
Let me know. If it works for you, mark the answer as accepted.
The second $domain of the sed command expands into aa in my test case. However, since the first $domain has its $ identifier escaped, it is NOT expanded.
There exists another command-line program called awk which has a more powerful way of passing variables from outside it to inside it, but sed is considered faster and more efficient (not sure if really true nowadays), so that's why I answered with sed because this was a simple case. In awk, you could use:
awk -v domain=aa '{gsub("\\$domain",domain);print}' ~/nginx_app >> ${domain}.conf
Here, the -v option to awk defines an awk variable, and gsub is an awk function for performing a global substitution for a given line. The escapinng sequence \\ is slightly longer than for the sed solution.