Nginx fastcgi_next_upstream off doesn't work

Maxim Dounin mdounin at mdounin.ru
Fri Nov 29 13:05:57 UTC 2013


Hello!

On Fri, Nov 29, 2013 at 03:50:52PM +0400, Oleg V. Khrustov wrote:

> nginx/1.5.4
> location / {
> ...
>                 fastcgi_pass   bg;
> fastcgi_next_upstream off;
> ...
> }
> 
> upstream bg {
> 
>     server unix:/tmp/dsp.1.sock;
>     server unix:/tmp/dsp.2.sock;
>     server unix:/tmp/dsp.3.sock;
>     server unix:/tmp/dsp.4.sock;
>     server unix:/tmp/dsp.5.sock;
>     server unix:/tmp/dsp.6.sock;
>     server unix:/tmp/dsp.7.sock;
>     server unix:/tmp/dsp.8.sock;
>     server unix:/tmp/dsp.9.sock;
>     server unix:/tmp/dsp.10.sock;
>     server unix:/tmp/dsp.11.sock;
>     server unix:/tmp/dsp.12.sock;
>     server unix:/tmp/dsp.13.sock;
> 
> }
> 
>  log_format combined-r '$time_local: upstream $upstream_addr responded
> $upstream_status in $upstream_response_time ms, request status $status is
> in $request_time ms';
> 
> 
> 29/Nov/2013:13:57:51 +0400: upstream unix:/tmp/dsp.4.sock :
> unix:/tmp/dsp.9.sock responded 504 : 504 in 0.148 : 0.050 ms, request
> status 504 is in 0.198 ms
> 
> 
> So nginx still pass request to next upstream dsp.4 -> dsp.9
> 
> 
> What can be wrong with this config?

The "504 : 504" in $upstream_status indicate that there were two 
requests to the upstream, with an internal redirect between them 
(note ":").  See here for the variable format description:

http://nginx.org/en/docs/http/ngx_http_upstream_module.html#variables

That is, everything works as expected, you just have an error_page 
redirection which does an additional request and confuses you.

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx mailing list