Laravel 502 特定路由调用的代理错误

Laravel 502 Proxy Error on specific route call

我遇到了特定于生产代码的问题。在所述服务器上,每次我尝试访问应该显示所有类别的 table 的特定路由时,我都会收到 502 代理错误:

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: Error reading from remote server

我已经在互联网上发现了一些常见问题,但是所有这些都是针对使用 nginx 的用户。我用拉拉贡。另外,Laravel 版本是 5.5.21

正如我所说,问题只是生产代码。当我在本地 运行 它没有发生。

我也尝试从服务器下载 laravel.log 文件,但那里什么也没有。

这是路由调用的函数:

public function index(){
        if(empty(request()->query()) && session()->exists('categories_filter')){
            return redirect(route('categories.index').'?'.http_build_query(session()->pull('categories_filter')));
        }

        if(!empty(request()->query())){
            $this->store_filter();
        }

        $categories = Category::orderBy($this->sort, $this->order);

        if($name_sk = request('name_sk')){
            $categories = $categories->where('name_sk', 'like', "%{$name_sk}%");
        }

        $categories = $categories->paginate(20);
        $all_categories = Category::with('children')->get();

        $sort = $this->sort;
        $order = $this->order;
        $new_order = $this->new_order;

        return view('admin.categories.index', compact('categories', 'sort', 'order', 'new_order', 'all_categories'));
    }

老实说,我不知道问题出在哪里或原因是什么。

对于有类似问题的人来说,这是我的问题所在:

我有一个递归的 blade 部分组件,它调用自身并且在每个组件中都执行了一个 sql 查询。我不得不完全重塑我的那部分观点。

所以解释一下,这个错误的原因很简单,就是我向数据库发送了太多请求,要求单行。这是一个问题,因为一旦有适量的数据,加载时间就太长了。