【问题标题】:GCP PHP App Engine - NGINX 404 when using custom runtimeGCP PHP App Engine - 使用自定义运行时的 NGINX 404
【发布时间】:2020-05-06 05:08:10
【问题描述】:

我有一个 Lumen/Laravel API 应用程序,当我使用默认 PHP 运行时将其部署到 App Engine Flex 时,该应用程序运行良好。

但是,当我使用自定义运行时(使用基本 PHP 运行时)时,我不断收到 NGINX 404 错误,我不明白,因为我只在 Dockerfile 中添加了 1 个额外的库

Dockerfile:

FROM gcr.io/google-appengine/php

RUN apt-get update -y
RUN apt-get install -y libdmtx-utils

app.yml:

runtime: custom
env: flex
resources:
  cpu: 0.1
  memory_gb: 0.6
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 1
readiness_check:
  app_start_timeout_sec: 3000
runtime_config:
  document_root: public
  front_controller_file: index.php

任何帮助将不胜感激!

【问题讨论】:

    标签: php google-app-engine google-cloud-platform


    【解决方案1】:

    使用您当前的设置,正在部署您的映像,但没有在其上部署代码,这就是您获得 404 的原因。

    您应该在 Dockerfile 中添加您的应用程序代码。如果您想了解这是如何完成的,请在此处查看 git for App Engine Custom 运行时的一些示例。

    此外,请检查 app.yaml 文件中的路径,以便为您的应用程序指向正确的文件夹。

    希望对您有所帮助!

    【讨论】:

    • 这样一个菜鸟错误,我当时以为 GCP 图像会提取文件。最后我制作了自己的 Dockerfile:pastebin.com/QJe8t2gr 谢谢你的帮助,让我在这个问题上花了几天时间
    猜你喜欢
    • 1970-01-01
    • 2016-08-08
    • 2018-10-14
    • 2020-10-17
    • 2018-07-04
    • 2018-04-20
    • 1970-01-01
    • 2021-02-27
    • 2016-04-04
    相关资源
    最近更新 更多