2017-05-08 59 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