Nginx Configuration:504 Gateway Time-out error
Solution 1:
Given that you can't connect to the backend directly using curl, the problem isn't an nginx config problem, but instead something lower-level. I'm going with firewall misconfiguration -- it's the catch-all problem in these situations.