I am trying do Fastcgi server based on location.
all request /api/v1/ -> server v1:9000 and /api/v2/ -> server v2:9000 my nginx config is
server {
listen 80;
index index.php index.html;
root /var/www/public;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass v1:9000;
if ( $uri ~ "^/api/v1/") {
fastcgi_pass v1:9000;
}
if ( $uri ~ "^/api/v2/") {
fastcgi_pass v2:9000;
}
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri /index.php?$args;
}
}