Nginx timeout

I just deployed a rails app using nginx/mongrel. The app takes a file
and then parses it, and does a bunch of stuff. It worked fine with
straight mongrel and with straight lighttpd, but on nginx/mongrel I
get a 504 Gateway Timeout error.

My error log shows:
2007/04/28 23:40:48 [error] 9434#0: *1 upstream timed out (110:
Connection timed out) while reading response header from upstream,

Is there a setting in the nginx.conf file to avoid that? It’s
happening with a file about 7.5MB large. Here are some relevant
settings from my conf file (cut/paste from various parts of the conf)

Thanks in advance…

worker_processes 6;
worker_rlimit_nofile 10240;

send_timeout 2250;
sendfile on;
tcp_nopush on;

keepalive_timeout 2250 120;
tcp_nodelay on;

client_max_body_size 150M;

On Apr 28, 2007, at 11:18 AM, Vince W wrote:

Is there a setting in the nginx.conf file to avoid that? It’s
tcp_nopush on;

keepalive_timeout 2250 120;
tcp_nodelay on;

client_max_body_size 150M;

Vince-

Nginx sets proxy_read_timeout to 60 seconds by default. So you need
to add a line like:

proxy_read_timeout 300;

Or however long you want. But it’s dangerous to have actions that
run for so long as it ties up resources unnecessarily.

Cheers-

– Ezra Z.
– Lead Rails Evangelist
[email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)

I faced the same problem but thankfully I was able to get out of it.

In my case, I was using a javacsript to submit the form that held the
file field. When I used a normal submit button, it all started working
fine. :slight_smile: I really dont know what exactly is wrong in submitting form
using a javascript but using the submit button instead worked.

You may want to try that…

Chirantan.

Ezra Z. wrote:

On Apr 28, 2007, at 11:18 AM, Vince W wrote:

Is there a setting in the nginx.conf file to avoid that? It’s
tcp_nopush on;

keepalive_timeout 2250 120;
tcp_nodelay on;

client_max_body_size 150M;

Vince-

Nginx sets proxy_read_timeout to 60 seconds by default. So you need
to add a line like:

proxy_read_timeout 300;

Or however long you want. But it’s dangerous to have actions that
run for so long as it ties up resources unnecessarily.

Cheers-

– Ezra Z.
– Lead Rails Evangelist
[email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)