Recently we have getting a bad gateway issue with our wordpress on Amazon EC2 Instance.
NGINX Bad Gateway, upon checking with tech they were able to fix it due to a font issue with AVIA, uploads/avia_fonts/flaticon/ and just changed it to Flaticon/
it worked for a good say 5-6 hours and then Bad Gateway error is back.
Not sure if this issue has been addressed before.