server {
listen 80;
server_name site.ru www.site.ru;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl http2;
include ssl/ssl_site.ru;
server_name www.site.ru;
rewrite ^(.*) https://site.ru$1 permanent;
}
server {
listen 443 ssl http2;
server_name site.ru;
include ssl/ssl_site.ru;
... other config string ...