On Apache web servers, each virtual host has a “ServerName” directive and zero or more “ServerAlias” directives. When converting to Nginx there is only one directive – “server_name” which takes the place of both of the Apache directives. The “server_name” directive takes a set of space delimited arguments listing domains that should match the virtual host. So for example if you have this Apache config:
1 2 3 |
ServerName acme.com ServerAlias www.acme.com ServerAlias acmeinc.com www.acmeinc.com |
Then for Nginx use:
1 |
server_name acme.com www.acme.com acmeinc.com www.acmeinc.com |
This is a simple example for full details see this page in the Nginx documentation:
http://nginx.org/en/docs/http/server_names.html