laravel Homestead 502 Bad Gateway 而不是 Whoops for PHP 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27173945/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:28:52  来源:igfitidea点击:

Homestead 502 Bad Gateway instead of Whoops for PHP errors

laravelnginxwhoops

提问by Ifnot

My Homestead Vagrant virtual machine is returning me a 502 Bad Gatewayinstead of a Laravel Whoops error for some PHP errors (like class not found, some kind of parse errors etc ...).

我的 Homestead Vagrant 虚拟机向我返回了一个502 Bad Gateway而不是 Laravel Whoops 错误,因为某些 PHP 错误(例如找不到类,某种解析错误等......)。

Does someone have the solution for briging Whoops for all PHP errors ?

有人有解决所有 PHP 错误的方法吗?

I could get the error reading manually /var/log/nginx/<my_vhost>.app-error.loglike this :

我可以/var/log/nginx/<my_vhost>.app-error.log像这样手动读取错误:

2014/11/27 15:15:44 [error] 1300#0: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error: <ERROR HERE> on line <LINE>

2014/11/27 15:15:44 [error] 1300#0: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error: <ERROR HERE> on line <LINE>

But it is very annoying for debugging ...

但是调试起来很烦...

Homestead version : 0.2.0. Laravel version : 4.2

宅基地版本:0.2.0。Laravel 版本:4.2

回答by Ifnot

After some searches I found a working solution.

经过一番搜索,我找到了一个可行的解决方案。

I have to add the following lines to my /etc/nginx/nginx.conf:

我必须将以下行添加到我的/etc/nginx/nginx.conf

http {
    ...
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    ...
}

Dont forget to edit with root rights with sudo

不要忘记使用 root 权限进行编辑 sudo

sudo nano /etc/nginx/nginx.conf

And then restart nginx

然后重启nginx

sudo /etc/init.d/nginx restart

Source of the info : https://laracasts.com/discuss/channels/general-discussion/whoops-doesnt-show-any-errors-homestead-20

信息来源:https: //laracasts.com/discuss/channels/general-discussion/whoops-doesnt-show-any-errors-homestead-20

回答by Mahfuz

my homestead was showing this because of php fpm package . so i run this comment and now working fine

由于 php fpm 包,我的宅基地显示了这一点。所以我运行这个评论,现在工作正常

sudo apt-get install php7.0-fpm  --fix-missing