Nginx Conf

Eric Wong normalperson at
Sun Nov 22 17:53:50 EST 2009

huet bartels <hbartels at> wrote:
> Thank you all very much for you time.  
> I will have a look at the configuration  examples today.

Sorry for the late reply, I forgot about this thread (and I'm lazy
about following links).

One general thing about the nginx configs I've seen is that they're
missing the fail_timeout=0 directive in the "server" lines.

I highly recommend setting it since it's a low cost to try an upstream
for nginx, and you can avoid 502 errors in case there's a bug in your
app that causes a Unicorn worker to not send a valid HTTP response
(including hitting the app timeout).

I actually have this in the Configurator documentation[1]:

    #    # See for more details
    #    # on nginx upstream configuration:
    #    upstream unicorn_backend {
    #      # for UNIX domain socket setups:
    #      server unix:/path/to/unicorn.sock fail_timeout=0;
    #      # for TCP setups
    #      server fail_timeout=0;
    #      server fail_timeout=0;
    #      server fail_timeout=0;
    #    }

[1] -

We've had fail_timeout=0 deployed to several places (many non-Unicorn
servers) here and there and have experienced no negative effects
(we're pretty good about keeping our backends up :)

If anybody can recommend a better place in the Unicorn docs to put this,
that'd be great, too...  Maybe I'll drop something in the examples/

Eric Wong

More information about the mongrel-unicorn mailing list