http {
include /etc/nginx/mime.types;
server {
listen 80;
root /app;
server_name test.work;
location / {
try_files $uri $uri/ @fpm;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
include fastcgi_params;
fastcgi_param REQUEST_URI $document_uri;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME /app/web/index.php;
fastcgi_pass php-fpm:9000;
}
location /assets/uploads {
root /app/backend;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri @fpm;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $document_root;
}
location @fpm {
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $document_root;
}
}
}
sudo apt-get update && sudo apt-get upgrade -y
- код бека останется чистым даже если завтра выйдет новый фронтовый фрейворк и возникнет необходимость перейти на него.