Failed (111: Connection Refused) While Connecting To Upstream

After following a tutorial on how to get Flask running with NGINX by Digital Ocean, I experienced some problems. In the erorr.log, I just found

failed (111: Connection refused) while connecting to upstream

and it took me some to figure the problem out. I read everywhere on the Web that the most problems with uWSGI are related to file permissions. In my case, the .sock file had the right configuration, but I was trying to log the output of the uWSGI process to a file that didn’t exist (that part was not covered in the tutorial). After creating the file and setting the adequate permissions, everything worked smoothly. In general, the tutorials by Digital Ocean are excellent.👌