gpt4 book ai didi

php - 部署在 CodePipeline 中的 Laravel Elastic Beanstalk 应用出现 500 服务器错误

转载 作者:行者123 更新时间:2023-12-01 23:37:51 25 4
gpt4 key购买 nike

我已经在本地创建了一个 Laravel 应用程序。 (这工作正常)

之后,使用 .zip 文件将该应用程序部署到 AWS Elastic Beanstalk。 (这工作正常)

enter image description here

然后,创建了一个simple pipeline using AWS CodePipeline从特定的 GitHub 存储库获取数据并部署到该特定的 AWS Elastic Beanstalk 环境。我看到我对那个特定的存储库所做的任何推送,CodePipeline 然后都会部署到那个特定的 AWS Elastic Beanstalk 环境。

问题是实例现在有

enter image description here

具有以下近期事件

Environment health has transitioned from Warning to Severe. 100.0 % ofthe requests are failing with HTTP 5xx. ELB processes are not healthyon all instances. Application restart completed 42 seconds ago andtook 7 seconds. ELB health is failing or not available for allinstances. One or more TargetGroups associated with the environmentare in a reduced health state: - awseb-AWSEB-CVIEEN5EVRFC - Warning

如果我访问它的 URL,我会得到一个

500 | SERVER ERROR

enter image description here

  • 从存储库的根目录中删除了 .zip 文件,因为这可能会导致冲突。它没有解决。

enter image description here

  • 检查了完整日志,但没有发现任何有用的信息。

最佳答案

基于评论。

问题是由 CodePipeline 部署的部署包/工件中缺少 .env 文件引起的。这是由于文件未提交到 GitHub 存储库造成的。

为了确定原因,检查了CodePipeline 的工件。该工件可以在 CodePipeline 的存储桶或 EB 应用程序版本(在“源”列中)中找到,它是一个没有扩展名的随机名称的对象。在 OP 的例子中是 S40pAMw。需要注意的是,这个对象只是一个没有扩展名的 zip 文件。要检查其内容,请将扩展名添加到下载对象,以便直接打开 zip 存档。

(请参阅@JackPrice-Burns 的回答以了解处理环境变量的替代方法)。

解决方案 是将丢失的文件提交到存储库中。一旦完成,就会触发 CodePipeline

enter image description here

部署完成后,Elastic Beanstalk 实例的运行状况变为正常

enter image description here

和 500 |服务器错误现在消失了

enter image description here

关于php - 部署在 CodePipeline 中的 Laravel Elastic Beanstalk 应用出现 500 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65339927/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com