A
A
a000_000a2018-01-31 17:34:18
Nginx
a000_000a, 2018-01-31 17:34:18

How to collect NGINX configurations from different files?

Tell me, please, how can I implement the assembly of the config file?
There are configuration files, these files are included in the nginx.conf file, but they have duplicate locations, tell me how you can separate the duplicate locations into a separate file and connect them to nginx. Sample nginx.conf
configuration

...
map $host{
    ....
}

include /path/file1.conf;
include /path/file2.conf;
include /path/file3.conf;
include /path/file4.conf;

file1.conf
server {
   listen 127.0.0.1:80;
   ...
  location ... {
      ...
  }
 location ... {
      ...
  }
}

file2.conf
server {
   listen 80;
   ...
  location ... {
      ...
  }
 location ... {
      ...
  }
}

file3.conf
server {
   listen 443 ssl;
   ...
  location ... {
      ...
  }
 location ... {
      ...
  }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question