Generally speaking, this situation may be caused by the response buffer of the default fastcgi process of nginx is too small, which will cause the fastcgi process to be suspended. If your fastcgi service does not handle the suspension well, then finally Very likely to cause 504 Gateway Time-out
The current website, especially some forums, has a lot of replies and a lot of content, and a page can even have hundreds of K.
Two, the solution
The default fastcgi process response buffer is 8K, we can set a larger one. In nginx.conf, add: fastcgi_buffers 8 128k This means that the fastcgi buffer is set to 8×128k
Of course, if you are performing an immediate operation, you may need to increase the nginx timeout parameter, for example, set it to 60 seconds: send_timeout 60;