upstream timed out (110: Connection timed out) while reading response header from upstream, client: X.X.X.X | 504 Gateway Timeout

This error indicates that there is a problem with communication between the Nginx server and the backend server it is proxying to.

upstream timed out (110: Connection timed out) while reading response header from upstream, client: X.X.X.X |
504 Gateway Timeout

From the error we can gather that the backend was still processing but a limit in NGINX was hit which is why it quit prematurely and threw this error.

nginx gateway timeout

To fix this you need to locate and edit your nginx vhost file and add the following line of code to the Location section:

proxy_read_timeout 3600;

Next, restart nginx

service nginx restart

That’s it, you’re done