0

I capture the server name like this:

server_name ~^(?<account>.+)\.myapp\.io$;

an later i try to use it on the same file, like:

include $account.conf;

but it returns:

nginx: [emerg] open() "/etc/nginx/$account.conf" failed (2: No such file or directory)

of course, the file exists.

If i use it somewhere else, it works, like:

access_log /var/log/nginx/$account-access.log;
CrazyRabbit
  • 439
  • 4
  • 13
  • 1
    Not all directives accept variables. `include` is one of them. – Alexey Ten Jun 08 '20 at 11:48
  • `include` directive is processed only when nginx starts, and at startup, there is no request where the `server_name` could be parsed from. What are you actually trying to accomplish? – Tero Kilkanen Jun 08 '20 at 18:10

0 Answers0