I'm running Nginx with PHP-FPM with a very common configuration, nothing special:
location / {
try_files $uri @fpm;
}
location @fpm {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_pass fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/app/public/index.php;
fastcgi_param SCRIPT_NAME index.php;
fastcgi_param APPLICATION_ENV dev;
}
The PHP-FPM is run in a container with a default PHP-FPM configuration (version 7.3 currently).
I found that if PHP script crashes unexpectedly without returning any response or when I debug a script with XDebug and stop debugging killing the request (not resume running until the end), Nginx returns the successful HTTP response code (200) with an empty response. How to make it returning an error code of the 5xx range in such cases? Probably, the problem could be in PHP-FPM returning a successful result but I didn't find any possible solutions for that.