In this case nginx reports 502.
Could you make debug log of this request ?
I found what is going on, finally. nginx indeed wants to report 502,
but then fails to find the file for 502 error:
2007/12/17 18:55:00 [error] 28745#0: *6 connect() failed (111:
Connection refused) while connecting to upstream, (…)
2007/12/17 18:55:00 [error] 28745#0: *6 open()
“/var/www/nginx-default/50x.html” failed (2: No such file or directory),
nginx wants to load this file as I have in my nginx.conf the line
(IIRC put there by default in the debian package)
error_page 500 502 503 504 /50x.html;
but the 50x.html file is in /var/www/nginx-errors, not in
So in the end it seems like some packaging inconsistency or my
forgotten mistake (I do not remember myself messing with those
params or files, but maybe …).
PS I am still not sure whether it would not be better to keep the
original error here, but I do not know for sure.