1. 云栖社区>
  2. PHP教程>
  3. 正文

Nginx overwrites Symfony errors with 502 Bad Gateway

作者:用户 来源:互联网 时间:2017-12-01 15:29:29

Nginx overwrites Symfony errors with 502 Bad Gateway - 摘要: 本文讲的是Nginx overwrites Symfony errors with 502 Bad Gateway, Today I’ve faced a interesting issue when I was trying to access a non-existing route in my Symfony application. Instea

Today I’ve faced a interesting issue when I was trying to access a non-existing route in my Symfony application. Instead of getting the Symfony error page with debug information, I was facing a default Nginx 502 Bad Gateway on my browser.

The log app/log/dev.log was showing me the error as below:

...
request.ERROR: Uncaught PHP Exception Symfony/Component/HttpKernel/Exception/NotFoundHttpException: "No route found for "GET /favicon.ico"" at /usr/share/nginx/www/mysysadmin.com/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 145 {"exception":"[object] (Symfony//Component//HttpKernel//Exception//NotFoundHttpException: No route found for /"GET /favicon.ico/" at vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:145, Symfony//Component//Routing//Exception//ResourceNotFoundException:at app/cache/dev/appDevUrlMatcher.php:343)"} []
event.DEBUG: Notified event "kernel.request" to listener "Symfony/Component/EventDispatcher/Debug/WrappedListener::__invoke". [] []

However, I still was tricked by why it wan’t showing on the browser.

To fix it I had to add the lines below into the Nginx config file for the domain:

location ~ ^/(app|app_dev|config)/.php(/|$) {
...
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
...
}

After restart Nginx the errors were showing on my browser again.

References

http://www.howtoforge.com/nginx-upstream-sent-too-big-header-while-reading-response-header-from-upstream

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索,以便于您获取更多的相关知识。