504 Gateway time-out issues common to Web sites that use Nginx as a Web server
I encountered this problem when I had to insert more than 10,000 data.
In general, this situation may be due to the Nginx default fastcgi process response buffer is too small, which will cause the fastcgi process to be suspended, if your fastcgi service is not good for this suspend processing, then it is very likely to cause 504 Gateway Time-out
Now the site, especially some forums have a lot of replies and a lot of content, a page even has hundreds of K
The default fastcgi process response buffer is 8K, we can set the large point
In nginx.conf, join:
Fastcgi_buffers 8 128k
This means that the fastcgi buffer is set to 8x128k
Of course, if you are doing an immediate operation, you may need to make the Nginx timeout parameter larger, for example, set to 60 seconds:
Send_timeout 60;
Solution 504 Gateway time-out (nginx)