Fastcgi_cache sometimes returns statuscode 500

mastercan nginx-forum at
Mon Mar 2 11:11:24 UTC 2015


Nginx (all versions since September 2014, but at least 1.7.9, 1.7.10)
sometimes returns HTTP status code 500, when serving pages from

Each time this happens, following conditions hold true:
*) $upstream_cache_status = HIT (so we don't even hit php-fpm)
*) $body_bytes_sent = 0 (which is strange, because I've got an error page
defined for http code 500, that is obviously not sent)

I've configured an error page for status code 500 which is correctly shown
on errors from PHP - this was tested for status code 503.
Nginx seems to have a bug here, I guess? Why would it otherwise return a
zero bytes size body?

This happens for about 30-40 requests a day. All other requests (several
thousand) are correctly returning status code 200. Server load/CPU load is
very low...

I've configured fastcgi cache as follows:
fastcgi_cache_path		/dev/shm/ngxcache levels=1:2 use_temp_path=off
keys_zone=MYSITE:5M max_size=50M inactive=2h;

Maybe somebody knows advice?


Posted at Nginx Forum:,256977,256977#msg-256977

More information about the nginx mailing list