Nginx 504 gateway timeout

My site is not completing full database backups + files. Always gives this error message: "504 bad gateway NGINX"

I have tried the fixes here http://www.queryadmin.com/933/nginx-504-gateway-timeout/