douxian5963 2017-05-08 19:19
浏览 39

Google App Engine - 提供来自同一目录的php和静态内容

How do I serve both php and static content (e.g. jpegs) from the same directory on Google App Engine? I have this 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

I can access e.g. /subdir/test1.php and /subdir/test1.jpg just fine from a browser when I run a local server with the "dev_appserver.py" command. However, when I deploy to live instance on google app engine, only /subdir/test1.jpg is accessible (test1.php gives 404 ... which is unexpected). When I remove the last 2 lines from app.yaml, only /subdir/test1.php is available (test1.jpg gives 404, as expected).

Is there a conventional way to server both static & php content to server out of the same directory on google app engine?

  • 写回答

1条回答 默认 最新

  • duanfen1992 2017-10-11 15:14
    关注

    See the accepted answer to my (sort of) similar question.

    In short, you use the application_readable handler option like so:

    # Serve static content
    - url: /subdir/
    static_dir: subdir
    application_readable: true
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决