This error may have been because the local DNS server is no present in the ip "127.0.0.1".
This may be checked with the file "/etc/resolv.conf". If it has the line "nameserver 127.0.0.53" then you need to adjust nginx to use "resolver 127.0.0.53;
" under "http
" instead of the default "127.0.0.1".