i have purchased a ssl for my site and a dedicated ip and in my hosting i have 12 website without ssl.
eg: i purchased a ssl for www.withssl.com and other are without ssl eg: www.withoutssl.com
but when i open www.withoutssl.com with https it show the content of my withssl.com website
To stop this, you basically just need to have a catch-all rule. Since you're dealing with HTTPS, you need a certificate/key to be able to return something other than the ONE rule you have for 443 port.
server {
listen 80 default_server;
#listen [::]:80 default_server; // uncomment for IPv6
return 444;
}
server {
listen 443 ssl http2 default_server;
#listen [::]:443 ssl default_server; // uncomment for IPv6
ssl_certificate /etc/nginx/cert/some_self_signed_thing.crt;
ssl_certificate_key /etc/nginx/cert/some_self_signed_thing.key;
return 444;
}