Welcome! Log In Create A New Profile

Advanced

nginx location fine routing multiple backend

February 20, 2014 04:47AM
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 {
...
}
Subject Author Posted

nginx location fine routing multiple backend

nenad February 20, 2014 04:47AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 247
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready