Reputation: 9655
I have fifteen virtual hosts (servers) with separate log location for it. I am a bit confused about which would be the best option to write nginx config file for each. All server blocks in one file or a separate file for each server?
Which would be a more efficient way?
Upvotes: 2
Views: 77
Reputation: 11
If there's some commonality between your virtual hosts configs, such as general SSL settings or denying certain types of requests, you may want to use includes.
I like to keep separate vhosts config files, it's easier to take one domain offline for maintenance for instance.
Upvotes: 1
Reputation: 14374
Nginx reads config once on start (or reload), so do whatever is more appropriate for you.
I would write related server blocks together in one file, and have one bunch of related servers per file.
Or have one file per server.
Or write them all in one file.
Upvotes: 2
Reputation: 31
Efficiency is not effected by how you define the blocks in nginx. Thus, it would be same in the given case.
Upvotes: 1