I'm trying to organize my vhost configs in several files, so that there is a view basic files / "templates" and the rest just include them and overwite settings as needed. Here is described, how the inheritance in nginx works. What I'd like to know, is: (how) is it possible to overwtire not the whole setting block / context (e.g. server
), but just an option (e.g. server_name
).
Example:
I've defined a server
block
server {
listen 80;
# server_name is not defined
if ($host ~ ^(?<project>.+)\.(?<area>.+)\.loc$) {
set $folder "$area/$project";
}
...
}
and want to set/rewrite set the setting server_name in another place. It should be look like
server.server_name foo.bar.loc;
Dotted syntax is not allowed. But maybe there is something like this?