How do I increase FastCGI read timeout to prevent 504 error on nginx?

I am running a file with considerable amount of coding. It takes approximately 55 seconds to process 500 users, but now I have to process 1000 users. The default timeout is 60 seconds, so I have to increase the FastCGI read timeout.

I found this question on StackOverflow that says I have to increase fastcgi_read_timeout but I don't know where to put it in fastcgi.conf.


Yes, you should use fastcgi_read_timeout. You can find documentation here. According to that, you can specify this parameter either in http, server or location context. So it is also possible to put in into fastcgi.conf and include that file where you setup FastCGI.