Can't increase timeout on nginx with php-fpm

Our nginx refuses to increase the timeout for a request from the default of 60 seconds.

I've already set the following parameters, but the server still gives me 504 after 60 seconds:

fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
client_header_timeout 300s;
client_max_body_size 200m;
client_body_timeout 300s;
send_timeout 300s;

Interestingly enough, setting the values to 30 seconds works and the request times out after 30 seconds. The request_terminate_timeout in php-fpm is also set to 300 seconds.

Which parameters do I have to set to get it further than 60 seconds?


So, if somebody else has that problem and can't find an answer, here is my fix, after 2 more hours of searching.

The culprit was our Amazon Load-balancer. The servers run on ec2-instances, which are behind a load-balancer. The load-balancer has an idle-timeout of 60 seconds set. Just setting this timeout to the desired value described here removed the 504.