The answer was to add a line: fastcgi_intercept_errors on;
Then, to process 404 and possibly return another status code from a PHP script: error_page 404 / 404.php; I just had to replace it with: error_page 404 = / 404.php;
Thanks to the kind people on the Nginx IRC channel who spent a few minutes of their time showing me the right direction.
source share