Nginx server_name is set to, so why is getting served too? [duplicate]

I have my Nginx conf set up as follows:

server {
    listen 443 ssl;

When I load, the site loads fine.
But when I load, the site loads as well. Why is this happening?

I set up the DNS records using Amazon Route 53 as:

A (IP)

So is a request to arriving at Nginx as a request to

If so, how do I differentiate requests to and at my server?


If this is the only server block that listens to port 443, it is used for all SSL connections to the server, independent of the actual domain name.

You need to make a server block with listen 443 ssl default_server entry to make a virtual host that is served when no other server block matches.

Source : Link , Question Author : Lorenz Forvang , Answer Author : Tero Kilkanen

Leave a Comment