server {
listen 80;
server_name localhost;
set $base_root "мой рут";
# set $base_root /;
# set $base_root /usr/share/nginx/academy.smartworld.team/;
root $base_root;
charset UTF-8;
index index.php index.html;
location / {
root $base_root/frontend/web;
try_files $uri $uri/ /frontend/web/index.php$is_args$args;
location ~ ^/assets/.+\.php(/|$) {
deny all;
}
}
location /admin {
alias $base_root/backend/web/;
try_files $uri /backend/web/index.php$is_args$args;
location ~ ^/admin/assets/.+\.php(/|$) {
deny all;
}
}
location ~ ^/.+\.php(/|$) {
rewrite (?!^/((frontend|backend)/web|admin))^ /frontend/web$uri break;
rewrite (?!^/backend/web)^/admin(/.+)$ /backend/web$1 break;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
location ~ /\. {
deny all;
}
}