【问题标题】:I am hosting my website (php files) in GAE. The app.yaml file is not routing the pages of my site. Error: No Found我在 GAE 中托管我的网站(php 文件)。 app.yaml 文件没有路由我网站的页面。错误:未找到
【发布时间】:2019-05-03 15:11:21
【问题描述】:

我的网站有8个页面,用php编写:https://intercultural.appspot.com在GAE中部署后,可以加载和显示index.php页面。但是,当我单击其他链接时,不显示其他页面:错误:未找到此服务器上未找到请求的 URL /file.php。

这是我的文件的目录:蓝色突出显示的是我网站的页面。 enter image description here

这是我的 app.yaml 文件:

runtime: php72 </b>

handlers:
# Serve a directory as a static resource.
- url: /styles
  static_dir: styles
  
# Serve images as static resources.
- url: /(.+\.(gif|png|jpg))$
  static_files: \1
  upload: .+\.(gif|png|jpg)$
  
# Serve your app through a front controller at index.php or public/index.php.
- url: /(.+\.php)$
  static_files: static/\1
  upload: /(.+\.php)$

# I add the "/" to url bellow as suggested but still get same error
- url: /.*
  script: auto
  secure: always

虽然它在浏览器中显示站点地址,但它显示:错误:未找到请求的 URL /file.php 在此服务器上未找到。

app.yaml 文件中缺少什么以正确路由到我网站的其他页面?

【问题讨论】:

标签: google-app-engine php-7.2 web-site-project app.yaml


【解决方案1】:

您在 app.yaml 中的最终条目的 URL 应为 url: /.*(带有斜杠)。这是匹配 https://intercultural.appspot.com/* 的 URL 所必需的。您可以在app.yaml reference 中查看示例。

【讨论】:

  • 您好,非常感谢您的回复。我将“/”添加到 url:/.* 但是,我仍然收到相同的错误:错误:未找到在此服务器上未找到请求的 URL /image.php。根据 PHP 7.2 的 app.yaml 配置文件,不需要“/”请参见此处cloud.google.com/appengine/docs/standard/php7/config/appref
【解决方案2】:

我已经修好了。 主要问题出在 php 版本中。我以为我的代码是用 php7.2 编写的,但实际上它是 php5.5,因此 app.yaml 无法正常工作。 这是 app.yaml 文件:

这是我的 app.yaml 文件

runtime: php55
api_version: 1

handlers:
- url: /styles
  static_dir: styles

- url: /(.+\.(gif|png|jpg))$
  static_files: \1
  upload: .+\.(gif|png|jpg)$
  application_readable: true

- url: /
  script: index.php
  secure: always

- url: /(.+\.php)$
  script: \1
  secure: always

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-22
    • 1970-01-01
    • 2011-01-31
    • 2016-11-21
    • 1970-01-01
    • 2019-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多