server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /dev/null; if ($host !~ ^(autoconfig.thelyoncompany.com|autodiscover.thelyoncompany.com|webmail.thelyoncompany.com|email.thelyoncompany.com|matrix.thelyoncompany.com|thelyoncompany.com)$ ) { return 444; } location / { return 301 https://host$request_uri; } }