Can multiple domain points a single nginx host with server_name?

Hello list,

I am in a process to configure nginx infront of apache. For vhost having
single domain like www.mydomain.com & mydomain.com ; there is no issue
to
configure by server_name directive.

But what to do where multiple domain points to a single apache vhost
using
apache server_alias directive ? Can nginx server_name simply points all
those domains to the required vhost of apache ?

is

nginx [ server_name test1.com test2.com www.test3.com ]

equivalent to

apache [
servername test1.com
serveralias test2.com www.test3.com ]

?

Thanks

Hello!

On Mon, Apr 28, 2014 at 05:13:57PM +0530, Joydeep Bakshi wrote:

is

nginx [ server_name test1.com test2.com www.test3.com ]

equivalent to

apache [
servername test1.com
serveralias test2.com www.test3.com ]

?

Yes.

http://nginx.org/r/server_name


Maxim D.
http://nginx.org/

On 28 Apr 2014 12:44, “Joydeep Bakshi” [email protected]
wrote:

?
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 :slight_smile:

HTH,
J

Thanks to both of you

On Mon, Apr 28, 2014 at 6:46 PM, Jonathan M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs