I have two domains that point to the same server, one we'll call home
and one we'll call web
.
I'm running nginx on port 80 for HTTP and 443 for HTTPS. In my server definitions, I've defined two servers:
server {
listen 80;
server_name web;
# ...
}
server {
listen 443;
server_name web;
# ...
}
In practice, it works just fine. However, when I try accessing home
, which points to the same IP address as web
, I get served web
rather than getting a 404 or the like.
How can I configure nginx to 404 requests that don't match a server name? Do I need to define a default server which just bounces things down to 404s?