can multiple domain points a single nginx host with server_name ?

Jonathan Matthews contact at jpluscplusm.com
Mon Apr 28 13:16:43 UTC 2014


On 28 Apr 2014 12:44, "Joydeep Bakshi" <joydeep.bakshi at netzrezepte.de>
wrote:
>  is
>
> nginx  [ server_name  test1.com test2.com www.test3.com  ]
>
> equivalent to
>
> apache  [
> servername test1.com
> serveralias   test2.com www.test3.com ]
>
> ?

As Maxim says, yes.

If you have hardcoded names, i believe there are 3 ways to format it:

1 -------------------
server_name foo.example.com foo2.example.com foo3.example.com;
2 -------------------
server_name foo.example.com
                   foo2.example.com
                   foo3.example.com;
3 -------------------
server_name foo.example.com;
server_name foo2.example.com;
server_name foo3.example.com;
---------------------

Note the different semicolon placement in each. They are, I believe,
functionally and performance-ly identical.

They each have their different uses depending on how you amend, interrogate
and share your configurations. E.g. #3 is handy when you'll be grepping for
the fixed string "server_name foo2.example.com".

Consistency is probably most important, however: choose one style and stick
to it :-)

HTH,
J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140428/7db2a72a/attachment.html>


More information about the nginx mailing list