如果在应用引擎上提供的URL中找到灵活的配置,我如何配置我的nginx-app.conf文件来提供/index.php?

问题描述 投票:0回答:1

我最近从bluehost将站点迁移到flex环境。通过这次迁移,我知道我需要配置我的nginx-app.conf文件以我想要的方式提供脚本/文件,但我不知道如何做到这一点。

我想模仿像bluehost,godaddy,hostgator等主机提供商...我可以在domain.com/path/上部署脚本,并且当向该路径发出请求时:domain.com/path/index.php如果存在则被加载,或者它会回落到index.html或throws 404错误

另外:如果请求直接发送到这样的脚本:domain.com/path/myscript.php然后加载相应的myscript.php文件(如果存在),或者抛出404错误。

我试图写我的nginx-app.conf文件如下:

location /~* { # try to serve file directly, fallback to front controller try_files $uri /index.php$is_args$args; }

但是当我在部署后点击任何链接时,它只会停留在同一页面上。

php google-app-engine nginx app-engine-flexible google-app-engine-php
1个回答
0
投票

经过几年的漫游,并处理灵活环境中无法忍受的缓慢部署时间,我能够提出以下有效的方法。

location / {
  try_files $uri?$args $uri/index.php?$args;
}
© www.soinside.com 2019 - 2024. All rights reserved.