【问题标题】:Laravel showing error from /var/app/ondeck after deployment aws elasticbeanstalkLaravel 在部署 aws elasticbeanstalk 后显示来自 /var/app/ondeck 的错误
【发布时间】:2017-11-01 16:32:35
【问题描述】:

使用 AWS Elasticbeanstalk 成功部署我的 laravel 5.4 应用程序后,当我访问我的根路由时,Laravel 在 FileViewFinder 异常中抛出 InvalidArgumentException 说 View [index] not found。

这是堆栈跟踪的 sn-p。

in FileViewFinder.php line 137

at FileViewFinder->findInPaths('index', array('/var/app/ondeck/resources/views')) in FileViewFinder.php line 79

at FileViewFinder->find('index') in Factory.php line 128

at Factory->make('index', array(), array()) in helpers.php line 914

at view('index') in HomeController.php line 24

如您所见,Laravel 试图从 /var/app/ondeck 中查找视图,据我所知,这是部署期间的临时位置,而不是部署后的位置。我到处搜索,似乎找不到类似的问题。

我们将不胜感激。

【问题讨论】:

    标签: amazon-web-services amazon-elastic-beanstalk laravel-5.4


    【解决方案1】:

    在与它斗争之后,我设法使用了一个部署后脚本 /opt/elasticbeanstalk/hooks/appdeploy/post/artisan_clear_cache.sh 来运行php artisan config:cache。 Laravel 缓存视图路径以指向 ondeck 目录,因此在部署后需要清除缓存。不幸的是,这种方法没有记录。所以我以这种方式解决了它。

    1. 我必须创建包含部署后挂钩的目录,因为默认情况下它不存在。运行mkdir /opt/elasticbeanstalk/hooks/appdeploy/post 即可。

    2. 我必须设置 Laravel 写入存储的权限。运行chmod -R 755 /var/app/current/storage 即可。

    3. 最后我不得不将 artisan 命令放入 .sh 中。

    这样脚本会在部署后自动运行并清除缓存。

    请注意,所有这些都必须在项目根目录中 .ebextensions 目录中的 .config 文件中完成。更多细节here

    【讨论】:

      猜你喜欢
      • 2014-03-02
      • 2014-09-03
      • 2020-03-04
      • 2018-07-30
      • 2021-06-10
      • 1970-01-01
      • 2017-08-02
      • 1970-01-01
      • 2015-11-01
      相关资源
      最近更新 更多