Include directive not allowed in upstream?

We have a number of upstream blocks for different vhosts / processes but
a number of them make use of the same backend nodes so I wanted to
simply out upsteam declarations by using includes. On doing so we get
the follow error:-
nginx: [emerg] “include” directive is not allowed here in

Seems like include is not possible in an upstream block. I can’t think
of a logical reason for this, any ideas?

Seems this would be quite a nice feature to add.

Posted at Nginx Forum:,203585,203585#msg-203585

I’m curious, do you base that logical reason on a “the code should allow
this” or “it would be nice to have”? There’s really no way to use
include in an upstream directive. You should make sure your vhosts use
the same upstream as opposed to defining multiple upstreams with
identical servers.

Posted at Nginx Forum:,203585,203692#msg-203692

My question is more, is there any reason why it can’t support this? I
can’t think of any reason why this shouldn’t be possible, its really
only a block in my mind.

You say there really no way to use include in upstream, but why is this?
I know it can’t currently but why?

Its not a case of the vhosts using the same upstream but more multiple
machines including blocks of hosts within to support their task, would
make what were trying to do cleaner and easier to mange.

Posted at Nginx Forum:,203585,203754#msg-203754