php - 在 GAE 上托管一个包含一些 php 文件的大部分静态网站
问题描述
我在 Google App Engine 上托管了一个主要是静态的网站,并且似乎在设置我的 app.yaml 时遇到了一些麻烦。要么就是这样,要么我的文件路径已关闭。我看过其他帖子,其中混合静态和动态内容似乎会带来一些麻烦,所以我决定这样设置我的文件:
Site (Root Folder)
app.yaml
contact (Dynamic page)
-index.php
projects (Nothing in here yet but will group dynamic content here)
README.md
www (Static files)
-blog
-css
-images
-index.html
-js
试图在我的主页上创建链接
/www/index.html
到我的联系页面
/contact/index.php
我应该将您从 index.html 引导到 index.php 的文件路径是
../contact/index.php
下面是我的 app.yaml
runtime: php55
api_version: 1
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
mime_type: home
secure: always
- url: /(.*)
static_files: www/\1
upload: www/(.*)
secure: always
application_readable: true
- url: contact/index.php
script: /contact/index.php
secure: always
不知道我在这里做错了什么。我尝试了几种不同的文件路径,但根本无法显示页面。当我单击应该将我带到联系人页面 (index.php) 的链接时,我收到 404 错误。
解决方案
contact/index.php
您的通配符包罗万象的处理程序在到达其正确的处理程序之前正在抓取。另外,您缺少前导斜杠。 mimetype: home
是不恰当的。试试这个:
runtime: php55
api_version: 1
handlers:
- url: /contact/index.php
script: /contact/index.php
secure: always
- url: /
static_files: www/index.html
upload: www/index.html
secure: always
- url: /(.*)
static_files: www/\1
upload: www/(.*)
secure: always
application_readable: true
推荐阅读
- c# - DataFormatString TimeSpan - 如何显示超过 24 小时?
- javascript - 如何通过 url 参数更改打开的图形元标记内容
- c++ - C++ 二进制文件处理抛出异常 0x006787EA
- assembly - 将 64 位寄存器的一个字节移动到 8 位寄存器
- apache-kafka - Logstash Kafka 输出插件
- c# - 使用 C#(在 UiPath 中)使用不带附件的 Exchange Web 服务获取电子邮件
- android - 带有主题样式的 TextAppearanceSpan
- r - 使用R查找日期是否在区间内
- vue.js - VueJS 在循环中两次渲染变量
- vue.js - IE11 错误:SCRIPT1006 - 应为 vue 应用程序的 ')'