Is it possible to use a variable in an nginx upstream directive?
upstream appserver {
server unix:/socks/$host.sock
}
I've search my little heart out and can't find the answer.
A) Is it possible?
B) Is this a terrible idea?
Is it possible to use a variable in an nginx upstream directive?
upstream appserver {
server unix:/socks/$host.sock
}
I've search my little heart out and can't find the answer.
A) Is it possible?
B) Is this a terrible idea?
It's generally a bad idea to do that kind of a configuration.
You are better off doing the following:
General config:
upstreams/*.conf:
Use a script to generate these files with changing variables for you and then reload config with
nginx -s reload
Example python script:
a) No.
b) Yes. Thought it could be useful for development config,
I see no problem with using this snippet in dev: