Test the connection timeout by tweaking those parameters: fastcgi_read_timeout, request_terminate_timeout, set_time_limit.
- If hitting the fastcgi_read_timeout setting, Nginx will terminate the HTTP connection with a HTTP 504
- If hitting the request_terminate_timeout setting, PHPfpm will terminate the HTTP connection with a HTTP 502
- If hitting the set_time_limit setting, PHP itself will terminate the HTTP connection with a HTTP 200