0

I cannot use a variable for fastcgi_pass directive as below

fastcgi_pass $image:9000;

I get the following error.

 2020/07/07 01:39:08 [error] 27#27: *1 no resolver defined to resolve php, client: 192.168.48.1, server: , request: "GET /info.temp.php HTTP/1.1", host: "127.0.0.3"

The $image variable has a valid value and if I hard code the value instead of the variable it will start to work.

Any workaround or fix please?

6
  • Is this happens inside a docker container? Jul 7, 2020 at 1:51
  • @IvanShatsky Yes. it does Jul 7, 2020 at 2:02
  • You probably need to use resolver 127.0.0.11; inside the docker, see this answer. Jul 7, 2020 at 2:06
  • @IvanShatsky Many Thanks. It fixed it. You are the best! Jul 7, 2020 at 2:15
  • @IvanShatsky It's so strange that a variable behaves differently than it's the same value Jul 7, 2020 at 2:20

1 Answer 1

1

The documentation states:

Parameter value can contain variables. In this case, if an address is specified as a domain name, the name is searched among the described server groups, and, if not found, is determined using a resolver.

You need to have a resolver configured because the value didn't match any of your defined upstream servers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .