M
M
marchelly2013-12-05 18:33:45
PHP
marchelly, 2013-12-05 18:33:45

Nginx + php-fpm + yii framework frontend/backend howto?

Hello,
I have nginx + php-fpm and a site on the yii framework.
When migrating from Apache, the following difficulties arose:
The htdocs structure is as follows:
dirs
files
....
frontend
- www - index.php and so on
- images
- js
backend
- www - index. php and so on
- images
- js
...
files
dirs
In the config
server {
root /var/www/site.com/htdocs;
...
It is necessary to do the following:
1. When entering in the browser:
site.com nginx used the frontend directory, processed php files, all paths to images and other files were taken there in the frontend
location / {
root /var/www/site.com/htdocs/frontend
...
2. When typing in the browser:
site.com/backend/ nginx used the backend directory, processed php files, all paths to images and other files were taken there -same in backend
location /backend/ {
root /var/www/site.com/htdocs/backend
...
I did not find a similar solution. The nginx examples didn't help. Let's discuss.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vit, 2013-12-05
@fornit1917

For location /, write the frontend folder as root, for location /backend , write the backend folder as root, respectively, only here you will need to add another rewrite ^/backend/(.*)$ /$1 break;

E
Eugene, 2013-12-05
@Nc_Soft

Isn't it easier to solve it with a subdomain?
do backend.site.ru and that's it.

W
Walt Disney, 2013-12-05
@ruFelix

So do it,
write the desired root in the location

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question