如何增加页面超时来防止504错误?
我正在运行一个包含大量代码的文件,并且必须为 1000 个用户处理它。处理500个用户大约需要55秒,所以我必须增加默认网关超时时间。
从 这个问题,我发现我必须增加fastcgi_read_timeout
,但我不知道把它放在fastcgi.conf
的哪里。
I am running a file with considerable amount of code and have to process it for 1000 users. It takes approximately 55 seconds to process 500 users, so I have to increase the default gateway timeout time.
From this question, I found that I have to increase fastcgi_read_timeout
, but I don't know where to put it in fastcgi.conf
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
fastcgi_read_timeout
应放置在您用于处理文件请求的位置。请参阅文档中的更多示例
fastcgi_read_timeout
should be put into a location which you're using for processing requests to your file.Please, see more examples in documentation
一种替代方法是加载页面的部分内容,例如仅包含名称和基本信息的列表(或其他内容)。加载完成后,使用 jquery 和 ajax 完成剩下的工作。
One alternative is also to load parts of the page, for instance the list (or whatever) with only the names, and basic info. And after load do the rest with jquery and ajax.