Nginx server_name is set to mydomain.com, so why is www.mydomain.com getting served too?
Posted
by
Lorenz Forvang
on Server Fault
See other posts from Server Fault
or by Lorenz Forvang
Published on 2014-08-22T20:14:00Z
Indexed on
2014/08/22
22:23 UTC
Read the original article
Hit count: 285
I have my Nginx conf set up as follows:
server {
listen 443 ssl;
server_name mydomain.com;
...
}
When I load https://mydomain.com
, the site loads fine.
But when I load https://www.mydomain.com
, the site loads as well. Why is this happening?
I set up the DNS records using Amazon Route 53 as:
A mydomain.com xxx.xxx.xxx.xxx (IP)
CNAME www.mydomain.com mydomain.com
So is a request to www.mydomain.com
arriving at Nginx as a request to mydomain.com
?
If so, how do I differentiate requests to www.mydomain.com
and mydomain.com
at my server?
© Server Fault or respective owner