Nginx + ispconfig redirect to https, why redirects to ssl subdomain for which there is no host in nginx?

In General there is a domain for example test.ru. There are domains qwe.test.ru and so forth.
In sawing in ispconfig nginx directives for site
location / {
if ($scheme = http) {
 return 301 https://$server_name$request_uri;
}
}

On setengah all the rules Robit, but if for example there is no virtual host for asd.test.ru something redirects to some siting with ssl. How borotsja? Maybe in the default gash listen 443, but without ssl(but then a bug in the browser--the browser's knocking at ssl same time). How to be?

As an option in the latest nginx vhost-a to add
if ($server_name != $host){
return 301 http://$server_name$request_uri;
}
. But not to rewrite each time this is the last host. Need of norms of the decision without crutches, ideally with nginx.conf and error with ssl does not match certificate domain
July 9th 19 at 10:07
1 answer
July 9th 19 at 10:09
How borotsja?

Reading documentation.

Find more questions by tags ISPConfigNginx