what’s the differences between etc/nginx/conf.d/discourse.conf and etc/nginx/nginx.conf? Which one is the real nginx configuration file?
Both of them are real configuration files interpreted by nginx.
The etc/nginx/nginx.conf file is installed by Ubuntu nginx package. Inside this file there is a line with:
That instructs nginx to process additional configuration in all .conf files in the /etc/nginx/conf.d directory.
discourse.conf is all (or at least most of) configurations that were written by Discourse developers, unless they needed to change nginx.conf for some reason.