10

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

4 Answers 4

7

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

Sign up to request clarification or add additional context in comments.

Comments

5

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/;
}

1 Comment

So what is the unit of time used here? proxy_connect_timeout 43200000; I guessed this is in milliseconds and thus it will make 12 hours of timeout ?
-1

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.

Comments

-6

That's an nginx timeout error.

1 Comment

looks to me like a nginx 504 Gateway Time-out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.