2014-12-02 29 views
1

在使用Yii2高级模板(https://github.com/yiisoft/yii2-app-advanced)之后,它需要前端和后端的不同文档根。如何在OpenShift for Yii2高级模板上设置不同的文档根

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和配置的虚拟主机有一个别名指向后端。

<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上有没有解决这个问题的方法?

回答

1

根据3月本次发布的博客文章(https://blog.openshift.com/openshift-online-march-2014-release-blog/): DocumentRoot的是根据情况按以下顺序墨盒控制脚本逻辑选择:

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等等。

+0

嗨科里等人, 感谢您的回答。我会接受这个答案,因为它告诉我OpenShift如何至少选择文档根目录。 – Sinaru 2014-12-06 07:01:38

0

虽然不熟悉OpenShift的结构,但我确实找到了一个使用他们的“快速入门”理念的回购协议,以便在他们的服务中使用框架。当然,这与Yii1相同,但是在Yii2和Yii2之间设置文档根目录是相似的。

该信息通常在您设置basePath的protected/config/main.php文件中设置。

从这里回购: https://github.com/Umasankar-Natarajan/yii-example

而且,在你不知道的情况下,也有在GitHub上Yii2回购已经有后端从前端分离,这样你就不必做此重建你自己。

请告诉Brian完成他一直在研究的那部小说,Stewie。

相关问题