Nginx 用 502 Bad Gateway 覆盖一般的 symfony 错误 [英] Nginx overwrites general symfony errors with 502 Bad Gateway

查看:26
本文介绍了Nginx 用 502 Bad Gateway 覆盖一般的 symfony 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试访问不存在的路由或在 Twig 模板中出错时,我没有获得带有调试信息的 Symfony 错误页面,而是被重定向到默认的 nginx 502 错误网关.

When I try to access a non-existing route or make a mistake inside a Twig template, instead of getting the Symfony error page with debug information, I get redirected to a default nginx 502 Bad Gateway.

日志显示有趣的一行:

013/07/17 16:11:41 [error] 16952#0: *187 upstream sent too big header while reading
response header from upstream, client: 127.0.0.1, server: ftwo.localhost, request: "GET    
/heasd HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "ftwo.localhost"

有什么想法吗?

推荐答案

在 nginx 配置中增加缓冲区大小,然后按照建议重新启动 nginx 此处.

Increase your buffer size in nginx configuration and restart nginx afterwards as suggested here.

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;

在你的配置的 php 部分进一步增加 fastcgi 缓冲区( location ~ .php$ )

Further increase the fastcgi buffer in the php section of your configuration ( location ~ .php$ )

fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;

来自 CodeIgniter 用户的问题的参考答案此处.

Referenced answer to a question from a CodeIgniter user here.

这篇关于Nginx 用 502 Bad Gateway 覆盖一般的 symfony 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆