Answer the question
In order to leave comments, you need to log in
Nginx + Yii2 = one domain, while projects are in different folders, does not work, how to do it?
Good afternoon.
The situation is this. There is a domain abc.com which is contained in the www folder.
In the www folder there are two folders www/a, www/b which contain projects written in Yii2.
How can I configure it so that, for example, when accessing abc.com/a, the first project with the Yii2 router is called, respectively, abc.com/b is another project?
Answer the question
In order to leave comments, you need to log in
The framework files must be taken out two levels higher, removed from the public folder. There, leave only assets, images and other public folders that are now probably in the web. And it is better to remove the web - this is a rudiment explicitly (to raise their content to a higher level).
in the folders www/a and www/b create different index.php in which to prescribe the path to the framework. Either to different ones or to 1, but different of its app, for example, to backend and frontend.
Are the index files in www/a/web and www/b/web ?
If yes, then it is necessary to register the /a and /b locations in the Nginx config for the abc.com server, redirecting to the www/a/web and www/b/web directories, respectively.
In general, storing projects in a directory accessible from the web is not good.
Sources on the WWW should never be stored.
Upload the sources to some folder that is inaccessible from the outside and create symlinks to them
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question