server {
listen 80;
server_name site.ru;
location / {
return 301 http://www.site.ru$request_uri;
}
}
server {
listen 80;
listen 443 ssl;
server_name www.site.ru;
ssl_certificate cert.crt;
ssl_certificate_key key.key;
server {
listen 80;
listen 443 ssl;
server_name example.com;
ssl_certificate path/to/cert;
ssl_certificate_key path/to/key;
return 301 $scheme://www.example.com$request_uri;
}
server {
listen 80;
listen 443 ssl;
server_name www.example.com;
ssl_certificate path/to/cert;
ssl_certificate_key path/to/key;
# rest goes here...
}