Unique server for all domains or a server per domain?

Max nginxyz at mail.ru
Thu Feb 9 00:58:37 UTC 2012


09 февраля 2012, 04:03 от "B.R." <reallfqq-nginx at yahoo.fr>:

> I am currently using a unique server conf for all my domains.
> When I wanna restrain certain activity to certain domains (subdirectories,
> URL rewriting, etc.) I do not have other choice than using 'if' on the
> $host variable leading to some complications due to the unreliable nature
> of the 'if' clause.
> The directory from which the content is served is determined by the
> hostname.
> 
> On the other side, is using several servers to listen on several domains
> the best solution?

Using separate per-domain server configuration blocks is both
more efficient and easier to configure and maintain. Using a
single server configuration block for many domains requires
many "if" blocks, which are computationally intensive to
evaluate, so you should avoid using them whenever possible.
Most of the time you'll be using "if" blocks for rewrites,
so it's better to just use separate server configuration
blocks with direct rewrites.

Max


More information about the nginx mailing list