nginx 504 网关超时

发布于 2024-11-09 01:47:03 字数 382 浏览 3 评论 0原文

我正在 nginx 上使用 phusion-passenger 运行 Rails3.0.7 项目。 当我正在做 ajax 时,大约需要 15 分钟来处理。 调用 ajax 10 分钟后,它会跳出一个 Firebug 错误,显示“504 Gateway Time-out”。

有人可以告诉我如何找到问题吗?

谢谢,本

环境

  • 操作系统:mac osx 10.6.7
  • ruby​​:1.9.2p180安装了rvm
  • gem:1.6.2
  • 乘客3.0.7rails
  • :3.0.7
  • mysql:5.5.10安装了brew
  • nginx:1.0.0独立安装了过路人

I'm running a rails3.0.7 project with phusion-passenger on nginx.
While I was doing a ajax which took about 15 mins to process.
It jump up an error with firebug which said "504 Gateway Time-out" after 10 mins from calling the ajax.

Could someon give me some idea of how I could find the problem.

Thanks, ben

environment

  • OS: mac osx 10.6.7
  • ruby: 1.9.2p180 installed with rvm
  • gem: 1.6.2
  • passenger 3.0.7
  • rails: 3.0.7
  • mysql: 5.5.10 installed with brew
  • nginx: 1.0.0 stand alone installed with passender

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

枫林﹌晚霞¤ 2024-11-16 01:47:03

这是 nginx 超时错误。如果您确实希望留出 10 分钟以上的时间来完成任务,请查看以下文章,了解一些关于需要调整哪个参数以避免超时的线索。

如何防止 nginx 网关超时

That's an nginx timeout error. Look at the following article for some clues as to which parameter you need to adjust to avoid the timeout, if you really want to allow more than 10 minutes to complete the task.

How do I prevent a gateway timeout with nginx

梓梦 2024-11-16 01:47:03

我在 Mac OS X (Yosemite) 上的 Rails 4 上也遇到了类似的问题。所以我将以下内容添加到我的特定 Nginx 位置中。

proxy_connect_timeout 43200000;
proxy_read_timeout    43200000;
proxy_send_timeout    43200000;

所以我的 Nginx 整体配置如下。

location /my_sub_path/ {
    root /my/rails/project/public/folder/path

    proxy_http_version 1.1;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;

    proxy_connect_timeout 43200000;
    proxy_read_timeout    43200000;
    proxy_send_timeout    43200000;

    proxy_redirect     off;
    proxy_set_header   Host             $http_host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_pass http://127.0.0.1:3000/;
}

I had the similar issue with Rails 4 on Mac OS X (Yosemite). So I have added the below into my specific Nginx location.

proxy_connect_timeout 43200000;
proxy_read_timeout    43200000;
proxy_send_timeout    43200000;

So my overall configuration for Nginx as below.

location /my_sub_path/ {
    root /my/rails/project/public/folder/path

    proxy_http_version 1.1;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;

    proxy_connect_timeout 43200000;
    proxy_read_timeout    43200000;
    proxy_send_timeout    43200000;

    proxy_redirect     off;
    proxy_set_header   Host             $http_host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_pass http://127.0.0.1:3000/;
}
顾冷 2024-11-16 01:47:03

这是 phusion-passenger 的问题。
您应该更改文件:(gems > Passenger-3.0.18 > ext > nginx > Configuration.c)

ngx_conf_merge_msec_value(conf->upstream_config.send_timeout,
                          prev->upstream_config.send_timeout, 6000000);

ngx_conf_merge_msec_value(conf->upstream_config.read_timeout,
                          prev->upstream_config.read_timeout, 6000000);

原点超时为 600000,只需 10 分钟。
我尝试更改 nginx.conf,但没有成功。

It's a problem from phusion-passenger.
You should alter the file:(gems > passenger-3.0.18 > ext > nginx > Configuration.c)

ngx_conf_merge_msec_value(conf->upstream_config.send_timeout,
                          prev->upstream_config.send_timeout, 6000000);

ngx_conf_merge_msec_value(conf->upstream_config.read_timeout,
                          prev->upstream_config.read_timeout, 6000000);

The origin timeout is 600000, just 10 minutes.
I've tried to change the nginx.conf, but didn't work.

浅笑依然 2024-11-16 01:47:03

这是 nginx 超时错误。

That's an nginx timeout error.

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