Q:

Prevent website being accessed NOT via the intended domain name

I have an nginx server on Debian with multiple domains. They all live in the html folder. Then the A records are pointed to my server and you can access the files in /var/www/html/mywebsite.biz by going to https://mywebsite.biz. I also assign them TLS certs using Let's Encrypt. 
It looks like this:
└── html
    ├── mywebsite.biz
    ├── anotherwebsite.net
    ├── example-three.com
    └── somewebsite.ca

However, you can access that html folder without TLS via my ip address like this:
http://216.58.216.78/mywebsite.biz
But I also have cases where I would want that to happen. e.g. if I want to set up a test site before I can point the domain to my server. For this, I used noip.com to assign it a friendly name like this:
http://myservername.ddns.net/somewebsite.ca (just a test site)
What's the best way to deny access via the ip address/friendly name for only some sites?
Deny/redirect these:
http://myservername.ddns.net/mywebsite.biz
http://216.58.216.78/mywebsite.biz
Allow this:
http://myservername.ddns.net/somewebsite.ca
My guess is to just redirect them there, but I'm a bit new with nginx and want to make sure that's the best way.

A:

Use this site config. It basically prevents Nginx responding to requests via IP. The "default_server" directive is the key part.
# This just prevents Nginx picking a random default server if it doesn't know which server block to send a request to
server {
  listen      80 default_server;
  server_name _;
  return      444; # This means "go away", effectively

  access_log off; log_not_found off; # Optional
}

