fastcgi_read_timeout is not proxy_read_timeout

A long-running request returning 504 after exactly sixty seconds is nginx timing out, and which directive applies depends on how the request reaches PHP.

# php-fpm over fastcgi
fastcgi_read_timeout 300s;

# an upstream over HTTP — a node process, or Apache behind nginx
proxy_read_timeout 300s;

# and the two that also have to agree
# php.ini:            max_execution_time = 300
# php-fpm pool:       request_terminate_timeout = 310s

Four numbers have to be consistent or the request is killed by whichever is smallest, and each reports the failure differently — nginx logs a 504, php-fpm logs a terminated child, and the application logs nothing at all. Setting the fpm terminate slightly higher than the execution time means PHP gets to run its shutdown handlers and write a log line before being killed. The better answer for anything genuinely long is a queue, and these settings are what buys time to build one.