A
A
ADA M2017-10-19 09:57:26
PHP
ADA M, 2017-10-19 09:57:26

Setting up a multi-tenant application on hosting?

I am developing a site on Yii2 (advanced template), which will consist of several applications:

admin.domain.com  =>  Приложение админки (папка /backend)
domain.com  =>  Приложение главной страницы сайта, типа лэндинга (папка /landing)
companyID*.domain.com (т.е. *.domain.com)  =>  Приложение (или сервис) для подключенных к сайту компаний,
 у всех похожий функционал и для всех одна общая база (папка /frontend)

Thus, my site will have 3 entry points (admin panel, landing page and company subsite). Why I decided to use the following settings on local hosting:
<VirtualHost *:80>
    DocumentRoot "E:/xampp/htdocs/domain.com/admin"
    ServerName admin.domain.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "E:/xampp/htdocs/domain.com/landing"
    ServerName domain.com
    ServerAlias www.domain.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "E:/xampp/htdocs/domain.com/company"
    ServerAlias *.domain.com
</VirtualHost>

  1. At the moment everything is working as intended, but is this the right decision from your point of view?
  2. Will there be any problems over time?
  3. Is it possible to implement this on shared hosting, where, as I know, there is only one entry point? If not, then on a VPS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mletov, 2017-10-19
@mletov

On many shared hostings, you can make several domains link to one folder. Usually through their web interface.
Well, there, along the way, you can analyze it in code or in .htaccess and slip the necessary logic depending on the domain.
Yii is especially useless here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question