server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://domain.com$request_uri ;
}
server {
listen 80;
server_name www.domain.ru domain.ru;
return 301 https://domain.ru$request_uri ;
}
server {
listen 443 ssl;
server_name www.domain.ru;
return 301 https://domain.ru$request_uri ;
}
server {
listen 443 ssl;
server_name www.domain.com;
return 301 https://domain.com$request_uri ;
}
server {
listen 443 ssl;
server_name domain.ru domain.com;
# основная секция
}