用于PHP应用程序的Google App Engine app.yaml文件(Magenta App)

时间:2014-06-23 01:30:31

标签: php google-app-engine magento yaml google-app-engine-patch

我正在使用这个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上测试应用程序,而不会有这么大的障碍。谢谢!

1 个答案:

答案 0 :(得分:0)

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

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

的app.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:

dispatch.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.comhttps://img-dot-viewneo-eu.appsport.com, ...

等等。

希望有所帮助。

此致

罗恩