在 openshift 中为 cakephp 3 配置 DocumentRoot

configure DocumentRoot for cakephp 3 in openshift

good 我是OpenShift 的新用户,今天看了文档,还不是很清楚,如何配置DocumentRoot。在我的例子中,我使用 cakephp 3 并且为了将我的应用程序投入生产,我需要配置 DocumentRoot,这应该是 webroot for production, I am very interested in OpenShift, I just need to get through this problem to carry my applications to the cloud. I read that OpenShift set DocumentRoot 但如果它适用于我的情况则不是。

好吧,如果无法手动更改 DocumentRoot 设置(只需请求他们的支持),那么您可以重命名您的应用程序 webroot 目录,使其符合 OpenShifts 自动文档根目录检测功能:

[...]

The DocumentRoot is chosen by the cartridge control script logic depending on conditions in the following order:

IF php/ dir exists THEN DocumentRoot=php/
ELSE IF public/ dir exists THEN DocumentRoot=public/
ELSE IF public_html/ dir exists THEN DocumentRoot=public_html/
ELSE IF web/ dir exists THEN DocumentRoot=web/
ELSE IF www/ dir exists THEN DocumentRoot=www/
ELSE DocumentRoot=/

[...]

https://developers.openshift.com/en/php-getting-started.html#set-document-root

如果你问他们,也许他们甚至会考虑将 webroot 添加到他们的脚本中。

正在更改您的应用程序 webroot 目录

要更改您的应用程序 webroot 目录,您需要做两件事

  1. 根据需要更改目录名称(例如 public

  2. 相应地调整应用 config/paths.php 文件中的 WWW_ROOT 常量(例如 define('WWW_ROOT', ROOT . DS . 'public' . DS);