0

我正在处理这个 app.yaml 文件以将 Magento 应用程序放在 GAE 上。我已经阅读了大多数与 app.yaml 文件相关的回复。这是wordpress应用程序的一个。但是,我对这么多不同的版本感到很困惑。 https://github.com/eGlobeBizCom/appengine-php-wordpress-starter-project/blob/9130e8ca06fa52a84821b8faffa49b83792b8ebf/app.yaml

但是,Magento 应用程序和 Drupal 结构与 Wordpress 应用程序不同。我已经尝试了几个版本的 app.yaml,但都不起作用。我真的很想知道 PHP 应用程序的 app.yaml 文件中正确代码的确切规则是什么,因此新手可以非常快速地在 GAE 上测试应用程序,而无需大费周章。谢谢 !

4

1 回答 1

0

这取决于,app.yaml 必须始终存在并且对应于您的默认模块。您可以在 google 开发者控制台 -> appengine -> 版本(应该是模块)中查看您的模块。每个模块可以有很多版本。

例如:要为您的应用程序文件(仅限 php 文件)和来自不同模块的静态文件(其他所有文件)提供服务,请查看以下 app.yaml 和 xml.yaml 文件:

应用程序.yaml:

application: viewneo-eu
version: pro # production
runtime: php
api_version: 1
threadsafe: true
instance_class: F4
automatic_scaling:
    min_idle_instances: 1 # one instance idleing forever
    max_idle_instances: 4 # 4 x 50 = 200 max requests
    min_pending_latency: 10ms # wait at least, before launching a new instance
    max_pending_latency: automatic # after this time, create a new instance
    max_concurrent_requests: 50

default_expiration: "0m"

handlers:
- url: /(.+)?/?
secure: always
script: build/mod_rewrite.php

- url: /.*
secure: always
script: build/mod_rewrite.php

xml.yaml:

application: viewneo-eu
module: xml
version: pro
runtime: php
api_version: 1
threadsafe: true
instance_class: F1
automatic_scaling:
  min_idle_instances: 1 # one instance idleing forever
  max_idle_instances: 4 # 4 x 50 = 200 max requests
  min_pending_latency: 10ms # wait at least, before launching a new instance
  max_pending_latency: automatic # after this time, create a new instance
  max_concurrent_requests: 50

default_expiration: "0m"

handlers:
- url: /(.*\.(appcache|manifest))
  mime_type: text/cache-manifest
  static_files: static/html/\1
  upload: static/html/(.*\.(appcache|manifest))
  expiration: "0m"
  application_readable: true
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.atom)
  mime_type: application/atom+xml
  static_files: static/html/\1
  upload: static/html/(.*\.atom)
  expiration: "1h"
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.htc)
  mime_type: text/x-component
  static_files: static/html/\1
  upload: static/html/(.*\.htc)
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.html)
  mime_type: text/html
  static_files: static/html/\1
  upload: static/html/(.*\.html)
  expiration: "7d"
  application_readable: true
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.tpl)
  mime_type: text/html
  static_files: static/html/\1
  upload: static/html/(.*\.tpl)
  expiration: "7d"
  application_readable: true
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.rss)
  mime_type: application/rss+xml
  static_files: static/html/\1
  upload: static/html/(.*\.rss)
  expiration: "1h"
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.txt)
  mime_type: text/plain
  static_files: static/html/\1
  upload: static/html/(.*\.txt)
  http_headers:
    Access-Control-Allow-Origin: "*"

- url: /(.*\.xml)
  mime_type: application/xml
  static_files: static/html/\1
  upload: static/html/(.*\.xml)
  expiration: "1h"
  application_readable: true
  http_headers:
    Access-Control-Allow-Origin: "*"

我已将各种内容类型拆分为不同的模块,这需要 dispatch.yaml:

调度.yaml:

application: viewneo-eu

dispatch:

- url: "fonts.viewneo-eu.appspot.com/*"
  module: fonts

- url: "img.viewneo-eu.appspot.com/*"
  module: img

- url: "css.viewneo-eu.appspot.com/*"
  module: css

- url: "js.viewneo-eu.appspot.com/*"
  module: js

- url: "html.viewneo-eu.appspot.com/*"
  module: html

- url: "cdn.viewneo-eu.appspot.com/*"
  module: cdn

- url: "video.viewneo-eu.appspot.com/*"
  module: cdn

- url: "audio.viewneo-eu.appspot.com/*"
  module: cdn

- url: "dev.viewneo-eu.appspot.com/*"
  module: dev

- url: "beta.viewneo-eu.appspot.com/*"
  module: beta

由于我们在 app.yaml 中始终使用安全,并且 ssl 不适用于通配符子子域,因此您始终可以通过以下方式访问它们

https://fonts-dot-viewneo-eu.appspot.com , https://img-dot-viewneo-eu.appsport.com , ...

等等。

希望有帮助。

问候

罗恩

于 2014-07-01T07:29:55.860 回答