I recently switched an application I am working on from nginx and mongrel to nginx and passenger. The setup is easy as can be but I noticed an issue on one of my long running operations. I have a controller that spawns some threads, performs operations and returns back a result to the page. Sometimes this takes a minute and using mongrel you would just increase the proxy_read_timeout in nginx. With passenger it times out after 60 seconds. There is not a configuration parameter for adjusting this. I found that adjusting upstream.read_timeout and upstream.send_timeout in /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1/ext/nginx/Configuration.c (below) to a higher value and reinstalling the passenger module solves the problem.
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.1/ext/nginx/Configuration.c
::snip::
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);
::snip::
Thanks to the passenger team and the quick response on the mailing list.
How do you reinstall the passenger module? And what configuration should be made on the http part of nginx.conf?
Basically re-running the nginx/passenger install should do it. It needs to compile the changes into the nginx-passenger module. No changes need to be made to your nginx config if you already are using nginx/passenger.
@joe: You said “Basically re-running the nginx/passenger install should do it.” Does this mean I need to reinstall nginx?
Note I am running apache/passenger/nginx. I’m not sure if this is the same as your setup.
Thanks!
Yeah, you need to reinstall the passenger nginx module after making the timeout change.