2017-05-08 56 views
0

如何在Google App Engine的同一目录中同时提供php和静态内容(例如jpegs)?我有这个app.yaml:Google App Engine - 从同一目录中提供php和静态内容

runtime: php55 
api_version: 1 

handlers: 

# Serve php scripts 
- url: /subdir/(.+\.php)$ 
    script: subdir/\1 

# Serve static content 
- url: /subdir/ 
    static_dir: subdir

我可以访问例如/subdir/test1.php和/subdir/test1.jpg当我使用“dev_appserver.py”命令运行本地服务器时,浏览器正好。但是,当我部署到谷歌应用程序引擎上的实例时,只有/subdir/test1.jpg可以访问(test1.php给出了404 ...这是意想不到的)。当我从app.yaml中删除最后2行时,只有/subdir/test1.php可用(test1.jpg给出404,如预期的那样)。

有没有一种传统的方法来将静态的& php内容服务器与Google应用引擎上的同一个目录中的服务器取出?

回答

0

查看我接受的答案(类似)question

总之,您使用application_readable处理器选项,如下所示:

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