Nginx location fine routing multiple backend

I neet to route requests to multiple backends, and I’m can’t match all,
what
I have so far:


root /srv/www;

== below does what it should ==
location ~
/assets/(.+.(?:gif|jpe?g|png|txt|html|css|eot|svg|ttf|woff|swf|js))$ {
alias /srv/www2/$1;

}

==> below should match only: /, /en, /en/, /de, /de/ but NOT: /search/,
/search this should be catched by last location
location ~ /$ {
alias /srv/www3;

try_files $uri $uri/ /index.php$is_args$args;
location ~* {

}
}

==> should match: /about, /en/about, /about/, /en/about/ … same alias
as
above probably this can mbe merged
location ~ (about|terms|privacy) {
alias /srv/www3;
}

==> below should match all other and send to php-fpm, I had must remove
location / as nginx don’t accept because ovveride

index index.php;
try_files $uri $uri/ @handler;

location @handler {
rewrite ^/(.*)$ /index.php/$1;
}

location ~ .php {

}

Posted at Nginx Forum: