Nginx returns 502 error when php-fpm returns 500

2019-07-28 23:26发布

问题:

I'm running nginx with php-fpm. Whenever my Symfony app crashes, it returns a 500 error with the debug info and stack traces I need. The problem is Nginx dumps that info and returns a 502 error with no content.

How can I configure nginx to forward along the 500 error and content from php-fpm?

回答1:

You can use "proxy_intercept_errors on" to transfer error code to client. http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors



回答2:

If your Symfony app crashes before any content was returned, then there is no content.