V
V
VMCLOUD2014-08-28 17:24:44
PHP
VMCLOUD, 2014-08-28 17:24:44

Nginx and get parameters, how to send to separate php-fpm pool?

Actually, there is a URL domain.com/somefile.php?sometext& id={id} &aid={aid}&m={b}&x={c}
I want to send everyone who passes the id={id} parameter to somefiele.php , to a specific php pool via location, and all those who do not pass the id={id} parameter to somefile.php (there is no id={id} parameter in the URL ) to another pool.
I suppose that through the location, but I can’t light up how ...
But I don’t know how ... Bright heads, advise ?!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Senkevich, 2014-08-28
@ssenkevich

If you follow the documentation , then something like this:

location /somefile.php\?.* {
    error_page 418 = @with_id;
    recursive_error_pages on;

    if ($args ~ id=) {
        return 418;
    }

    #without id
    ...
}

location @with_id {
    ...
}

V
Vlad Zhivotnev, 2014-08-29
@inkvizitor68sl

map arg_id backendname { 
blah localhost:8080;
blah2 localhost:8080;
default localhost:8081; }
...
proxy_pass http://$backendname;

Somehow, I'm too lazy to check the syntax.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question