如何在OpenShift for Yii2高级模板上设置不同的文档根目录 [英] How to set up different document roots on OpenShift for Yii2 advanced template

查看:95
本文介绍了如何在OpenShift for Yii2高级模板上设置不同的文档根目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我使用Yii2高级模板之后( https://github.com/yiisoft/yii2-应用高级),它需要为前端和后端使用不同的文档根目录.

After I use the Yii2 advance template (https://github.com/yiisoft/yii2-app-advanced) it needs different documents roots for frontend and backend.

Set document roots of your Web server:

for frontend /path/to/yii-application/frontend/web/ and using the URL http://frontend/
for backend /path/to/yii-application/backend/web/ and using the URL http://backend/

在我的本地计算机上,我设置了apache并将虚拟主机配置为具有指向后端的别名.

In my local machine I have set up apache and configured the virtual host to have an alias to point to backend.

<VirtualHost ..:80>
    ServerAdmin ..
    ServerName .
    DocumentRoot "...\frontend\web"
    <Directory "...\frontend\web">
        Require all granted
    </Directory>
    Alias /backend "...d\backend\web"
    <Directory "...\backend\web">
        Require all granted
    </Directory>
</VirtualHost>

但是我不知道如何在OpenShift中做到这一点.请让我知道OpenShift上是否对此有任何解决方案?

but I can't figure out how to do it in the OpenShift. Please let me know if there's any solution for this on OpenShift?

推荐答案

根据三月份的此发布博客文章(

According to this release blog post in March (https://blog.openshift.com/openshift-online-march-2014-release-blog/): 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=/ 

我敢肯定,您会猜到,这使新的OpenShift应用程序目录结构与所有主要的上游PHP项目兼容,包括Drupal,WordPress,Joomla,Zend Framework Skeleton Apps等.

As I’m sure you’ve guessed, this makes the new OpenShift app directory structure compatible with all major upstream PHP projects, including Drupal, WordPress, Joomla, Zend Framework Skeleton Apps and many others.

这篇关于如何在OpenShift for Yii2高级模板上设置不同的文档根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆