Little but simple question I guess!? (Wrong) webpage appears on unassigned domain

SYSTEM INFORMATION
OS type and version Deb 12
Usermin version 2.203
Virtualmin version 7.30.8
Theme version 23.03
Nginx version 1.22.1
Package updates All installed packages are up to date

Hi there,

It’s me again — but this time with a simple one instead of a complex question. It might just be a dumb oversight on my part, but please spare me the “ID10T error” jokes. I know… :wink:

So, what’s happening: whenever I add a new domain to my server and haven’t yet installed any Nginx config or used the domain for anything web-related, if I try visiting the domain in a browser, it always loads the most recently created website. That’s not ideal.

How can I make it show nothing — or preferably just nothing — for domains that don’t yet serve any content? Some of these domains aren’t meant to be accessed through a browser at all.

You cannot make it show nothing. Your web server is going to accept the connection, because it doesn’t know what domain is being requested until it accepts the connection and receives the host header from the browser, and the web server will serve the closest match available (even if the closest match is just “well, it’s on the same IP, so I’ll just pick the first one listed in the configuration file”).

You can choose which domain is the “default”, however, which makes it first in the list of virtual hosts. And, I guess you could make that domain serve a mostly empty HTML document that is a blank page or an error or something. (Or you could even make it serve an error, like a 404 or whatever, but that’s probably not the nicest thing to do.)

You can choose a domain as the “default” by browsing to Web Configuration->Website options and selecting “Yes” for “Default website for IP address”.