Unique server for all domains or a server per domain?

Hello,

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?
Since NGinx is event-based and not client-based maybe that’s not a
problem
anymore… But not so long ago I was stuck with Apache. I still need to
get
used to that (great!) change.

B. R.

09 февраля 2012, 04:03 от “B.R.” [email protected]:

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

OK, received loud and clear!

Many thanks,

B. R.