In one of my nginx
sites-available configuration file, I can specify a server name alias, like so:
server_name example.com www.example.com;
If I had an Apache server, I can do something similar with
ServerName example.com ServerAlias www.example.com
I have also specified a
CNAME record in my zone file:
www.example.com. 1800 IN CNAME example.com.
example.com to server the same content. Since I have a
CNAME record, all
www.example.com will be pointed to
example.com anyways, so there's no need for the alias. The argument can also be turned on its head to say the
CNAME record is not needed.
Is the alias in my web server (nginx or Apache) and the CNAME record redundant? If so, should I get rid of one of them? And if so, which one?