[英]Google App Engine - serve php and static content from same directory
如何从 Google App Engine 上的同一目录提供 php 和静态内容(例如 jpegs)? 我有这个 app.yaml:
runtime: php55 api_version: 1 handlers: # Serve php scripts - url: /subdir/(.+\.php)$ script: subdir/\1 # Serve static content - url: /subdir/ static_dir: subdir
当我使用“dev_appserver.py”命令运行本地服务器时,我可以很好地从浏览器访问例如/subdir/test1.php 和/subdir/test1.jpg。 但是,当我部署到 google 应用程序引擎上的实时实例时,只能访问 /subdir/test1.jpg (test1.php 给出 404 ... 这是意外的)。 当我从 app.yaml 中删除最后两行时,只有 /subdir/test1.php 可用(test1.jpg 给出 404,正如预期的那样)。
有没有一种传统的方法可以将静态和 php 内容都服务器到谷歌应用引擎上的同一目录中?
请参阅我的(某种)类似问题的已接受答案。
简而言之,您可以像这样使用application_readable
处理程序选项:
# Serve static content
- url: /subdir/
static_dir: subdir
application_readable: true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.