Yii 2.0 Deployment On Production Servers

Hey guys. So I understand this new setup of separating backend and frontend is similar to what Antonio did with his custom templates ( http://yiinitializr.2amigos.us/ ). This directory structure is cool and all but how will we be able to deploy this on a shared hosting environment because we normally have only one webroot and this has two (i.e. backend/web and frontend/web) So this something that is a setting of yii config or do I need to setup .htaccess to handle two different web roots? I had the same problem with Yiinitializr and had to abandon it.

If you are on a shared host that does not allow you to define mutliple webroots under different subdomains you can not run that application there. Better get a hoster that allows you to define subdomains like this:

backend.mydomain.com -> /ftpbroot/backend/web

www.mydomain.com -> /ftpbroot/frontend/web

If you want your application to run on any shared host you have to change the directory strucutre so that index.php of one application is in the root of the project and the other is in a subdirecory.

@Cebe, you are right.

I have implemented the same for a site in which i have used some code from phundament and Antonio’s Boilerplate structure. Somehow it is working but eventually you will be tearing your hair out

I was afraid you were gonna say that CeBe. I did find out a way to do this through htaccess but that comes with a lot of problems as well. Any recommended hosting services for this?

digitalocean, hetzner.

For yii-app-advanced you need to use the suggestion by Cebe.

An alternative is to use another application configuration which is in between yii-app-basic and yii-app-advanced. If needed I may post it as a wiki or extension when I get time. Basically work on the yii-app-advanced and change it for single domain usage. You can move the frontend web folder contents to root, and change the bootstrap index.php for frontend and tweak backend index.php and some backend config files to achieve this in one single domain with a subdirectory.

FYI - you can now do virtual directories on Windows Azure web sites. They are configured at the bottom of the ‘Configure’ tab from within the portal. You can get up to 10 websites free BUT you can’t use your own domain with the free hosting…you end up with: {your site name}.azurewebsites.net

Would very much like to know what those 'some’s are, as I’m in this situation (actually, I’m only testing and just have my personal domain which will not be the final domain… so the app is buried a little anyway ;))