如何增加页面超时来防止504错误?

发布于 2025-01-02 05:53:21 字数 273 浏览 3 评论 0原文

我正在运行一个包含大量代码的文件,并且必须为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白馒头 2025-01-09 05:53:21

fastcgi_read_timeout 应放置在您用于处理文件请求的位置。

location {
     fastcgi_pass you.app:9000;
     ... 
     fastcgi_read_timeout 900s; # 15 minutes
}

请参阅文档中的更多示例

fastcgi_read_timeout should be put into a location which you're using for processing requests to your file.

location {
     fastcgi_pass you.app:9000;
     ... 
     fastcgi_read_timeout 900s; # 15 minutes
}

Please, see more examples in documentation

白鸥掠海 2025-01-09 05:53:21

一种替代方法是加载页面的部分内容,例如仅包含名称和基本信息的列表(或其他内容)。加载完成后,使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文