Nginx Conf

Dylan Stamat dstamat at elctech.com
Sun Nov 22 22:57:02 EST 2009


On Nov 22, 2009, at 2:53 PM, Eric Wong wrote:

> huet bartels <hbartels at i-neda.com> 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 http://wiki.nginx.org/NginxHttpUpstreamModule 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 192.168.0.7:8080 fail_timeout=0;
>    #      server 192.168.0.8:8080 fail_timeout=0;
>    #      server 192.168.0.9:8080 fail_timeout=0;
>    #    }
> 
> [1] - http://unicorn.bogomips.org/Unicorn/Configurator.html
> 
> 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/
> directory.
> 
> -- 
> Eric Wong
> _______________________________________________
> mongrel-unicorn mailing list
> mongrel-unicorn at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn

Hey Eric,

Yeah, an nginx.conf in examples/ would be great.
It's probably going to be the most widely used front for Unicorn/Rainbows!, so
a sample config with some explanations here and there would be awesome.
It was great setting up Unicorn and being able to just grab the init.sh out of there!

In terms of the fail_timeout, I haven't seen a nginx.conf with that entry yet!
Maybe I'm looking at configuration files on the wrong projects ;)
So, since the upstream attempts are cheap, the combination of a max_fail of 1
and fail_timeout of 0 is ideal?  If the fail_timeout was at 10, and all the
upstreams timed out, wouldn't it restart at the beginning of the round-robin, and
not block... or... would it actually not retry on any due to the inoperable state?

Thanks!
==
Dylan Stamat

ELC Technologies (TM)
1921 State Street
Santa Barbara, CA 93101
dstamat at elctech.com

(866)863-7365 Tel
(866)893-1902 Fax

+44 (0)20 7504 1346 Tel - London Office
+44 (0)20 7504 1347 Fax - London Office

http://www.elctech.com



More information about the mongrel-unicorn mailing list