Hello,
Which distro are you using?
The first thing that comes to mind with this type of issue is that Selinux is enabled and blocking nginx from making connections to the upstream. You can test if this is the case by turning Selinux off and seeing if that resolves the issue.
This of course only applies to distros that enable Selinux by default (RHEL and crew for sure). I'm not sure if AppArmor can cause the same issues on Debian, but it might be worth looking into if that's what you're using.
-- Justin