server {
listen 80;
server_name
domain.com;
location / {
root /path/to/static;
index index.html;
try_files $uri $uri/ /index.html =404;
}
location /api
root /path/to/backend;
index index.php;
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_pass fastcgi_backend;
}
}
}