Answer the question
In order to leave comments, you need to log in
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
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;
Isn't it easier to solve it with a subdomain?
do backend.site.ru and that's it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question