运行 来自子目录 nginx 的 Silex,无配置访问权限

Run Silex from subdirectory nginx, no config access

我在客户服务器上有一个较旧的 PHP 项目,无法访问配置文件,服务器运行 nginx,并且 PHP 5.4 ...

有没有办法从子文件夹中使用 Silex Framework 或其他现代 PHP 框架? .. 例如。 example.com/silexproject/ 没有访问网络服务器的 .config 文件?

是否有替代 .htaccess 的 nginx?

快速 google 搜索,显示不,there is not an .htaccess like file for nginx。引用官方wiki:

Stop using .htaccess. It's horrible for performance. Nginx is designed to be efficient. Adding something like this would destroy that.

记住你仍然可以使用 Silex(我想你也可以使用任何现代 PHP 框架)你只需要记住每次调用前端控制器(所以你的 URLs 不会是 漂亮 )。

例如,如果您的项目在 http://example.com/projectdir/ your front controller most likely will be http://example.com/projectdir/index.php and if you need to access some resource under that path, you'll need to type http://example.com/projectdir/index.php/path/to/resource(注意 URL 中前端控制器的名称)

我的建议是,您将尝试联系有权访问 nginx 配置文件的任何人,询问他们是否可以更改 nginx 配置。