【问题标题】:Laravel doesn't show errors on the screen but shows 404 Not Found page of NginxLaravel 不会在屏幕上显示错误,但会显示 Nginx 的 404 Not Found 页面
【发布时间】:2022-01-01 04:50:46
【问题描述】:

我在 .env 文件中将 APP_DEBUG 设置为 true。但是 Laravel 不会在屏幕上显示错误消息和错误的详细信息。相反,Laravel 显示 Nginx 的 404 Not Found 页面。

所以,每次发生错误时,我都必须使用终端应用程序检查 laravel.log。

我使用的是 Laravel 8。我今天安装了它,默认情况下会发生这种情况。

我该如何解决这个问题?

【问题讨论】:

  • 如果您看到 nginx 404 页面,则表示您没有在 nginx 中正确设置主机配置。
  • @apokryfos 感谢您的评论。阅读您的评论后,我查看了 nginx.conf 并找到了解决方案。我自己发布了答案。

标签: laravel


【解决方案1】:

要在屏幕上显示 Laravel 错误,请从 nginx.conf 中删除所有现有的 404、500 等 error_page 指令并添加 error_page 404 /index.php;

https://laravel.com/docs/8.x/deployment

【讨论】:

    猜你喜欢
    • 2021-03-07
    • 1970-01-01
    • 2015-05-31
    • 2015-06-04
    • 2018-12-03
    • 1970-01-01
    • 2019-09-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多