3

I'm facing the same issue as described in How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass? and thus wanted to apply the same solution.

My NginX, version 1.15.2, config now looks like this:

server { resolver 127.0.0.1; set $backend "http://dynamic.example.com:80"; proxy_pass $backend; } 

Upon starting, I see the following error message

[emerg] 11#11: invalid number of arguments in "set" directive in /etc/nginx/conf.d/default.conf:3

Any clues?

3
  • Are you sure there's actually a semicolon after the set directive? This kind of error usually means a missing ';' at the end of the line. Commented Sep 4, 2018 at 14:28
  • Yep, this is a direct copy/paste Commented Sep 4, 2018 at 14:31
  • I have the same issue. (see my last question). I'm also using envstub during nginx startup (but for the value which I set so: set $backend "http://$URL"; (where URL is set bij envstub). Any idea on this? Commented Sep 4, 2018 at 15:50

1 Answer 1

4

The Nginx config itself was indeed correct.

The problem I had was envsubst also replacing the $backend variable with an empty space.

3
  • 1
    Can you add how you were doing the envstub Commented Sep 4, 2018 at 16:27
  • I need the envstub but also the variable Commented Sep 5, 2018 at 6:44
  • found the solution here: serverfault.com/questions/577370/… Commented Sep 5, 2018 at 6:46

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.