rospo
(Giovanni Rocchini)
February 6, 2016, 12:15pm
1
Hello to everybody,
i’m thinking about developing a new website with Yii2 Framework.
The website will have multiple subdomain with lot of share component and model. For example, all subdomains will have a blog and pages.
Now, i would like to understand if i can set up the common environment (eg the folders common, console, environments, tests, vendor) in the main domain (domain.com ) and set up different application for each subdomain (first.domain.com , second.domain.com ).
In this way, i would like to maintain only one Yii installation and not clone common model and controller.
Can Yii do it? What should i check for choosing the hosting (any idea about a good hosting to do that?)? What should i config?
Thanks
danaluther
(Dana Luther)
February 7, 2016, 4:21pm
2
Yes, check out the advanced application template, as that’s exactly what it is.
Yii 2 Advanced Project Template
===============================
Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
developing complex Web applications with multiple tiers.
The template includes three tiers: front end, back end, and console, each of which
is a separate Yii application.
The template is designed to work in a team development environment. It supports
deploying the application in different environments.
It also goes a bit further regarding features and provides essential database, signup and password
restore out of the box.
Getting Started
---------------
* [Installation](start-installation.md)
* [Difference from basic project template](start-comparison.md)
This file has been truncated. show original
1 Like
rospo
(Giovanni Rocchini)
February 11, 2016, 7:48pm
3
Thanks Dana!
So, as I read in Adding more applications , I can add multiple environment as I need.
If I understood correctly, i will have all the folder in the same point, so backend, frontend and blog.
But how can i configure them as subdomain? Eg, in my common/config/bootstrap.php i have
Yii::setAlias(‘backend’, dirname(dirname(DIR )) . ‘/backend’);
This means that the backend is accessible by www.mysite.com/backend . What should i do to have backend.mysite.com ?
Thanks!!
jacmoe
(Jacob Moena)
February 11, 2016, 7:55pm
4
jacmoe
(Jacob Moena)
February 11, 2016, 7:56pm
5
Actually, if you care to read the advanced template readme, it is all explained in it:
Installation
============
## Requirements
The minimum requirement by this project template is that your Web server supports PHP 5.4.0.
## Installing using Composer
If you do not have [Composer](http://getcomposer.org/), follow the instructions in the
[Installing Yii](https://github.com/yiisoft/yii2/blob/master/docs/guide/start-installation.md#installing-via-composer) section of the definitive guide to install it.
With Composer installed, you can then install the application using the following commands:
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
The command installs the advanced application in a directory named `yii-application`. You can choose a different
directory name if you want.
It uses [asset-packagist](https://asset-packagist.org/) for managing bower and npm package dependencies through Composer. Also you can use [asset-plugin](https://packagist.org/packages/fxp/composer-asset-plugin), as in earlier versions, but it works slowly.
This file has been truncated. show original
rospo
(Giovanni Rocchini)
February 11, 2016, 8:32pm
6
Perfect!!
Thanks jacmoe, i understood!!!