Extending the timeout for Rails processes through Passenger on Nginx
I recently had to allow for a long running reporting task in a Rails app which is running under Passenger (mod_rails) on Nginx
The default setting is 60 seconds and setting send_timeout to 300 in the Nginx config wasn’t working.
After much searching, I found the answer. Edit
ngx_conf_merge_msec_value(conf->upstream.send_timeout, prev->upstream.send_timeout, 60000);
ngx_conf_merge_msec_value(conf->upstream.read_timeout, prev->upstream.read_timeout, 60000);
ngx_conf_merge_msec_value(conf->upstream.read_timeout, prev->upstream.read_timeout, 60000);
to (for a 5 min timeout)
ngx_conf_merge_msec_value(conf->upstream.send_timeout, prev->upstream.send_timeout, 300000);
ngx_conf_merge_msec_value(conf->upstream.read_timeout, prev->upstream.read_timeout, 300000);
ngx_conf_merge_msec_value(conf->upstream.read_timeout, prev->upstream.read_timeout, 300000);
You will then need to recompile nginx and restart it (sending the HUP signal won’t work in this case)
Hope this helps someone else out there.
- Person:


Recent comments
1 year 23 weeks ago
1 year 23 weeks ago
1 year 25 weeks ago
1 year 27 weeks ago
1 year 42 weeks ago
1 year 45 weeks ago
1 year 45 weeks ago
1 year 45 weeks ago
1 year 46 weeks ago
1 year 48 weeks ago