Is there any way I can make the error 504 gateway timeout longer if so how and where is the file to change it located. I am using nginx on centos 6
Depending on the kind of gateway you have you should use something like:
proxy_read_timeout 600s;
Check docs: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout