server {
listen 80 default_server;
listen [::]:80 default_server;
location / {}
}
server {
listen 80;
listen [::]:80;
server_name www.*;
return 301 $scheme://$host$request_uri;
}
server { listen 80; listen [::]:80; server_name www.*; return 301 $scheme://$host$request_uri; }
server {
listen 80;
listen [::]:80;
server_name ~^www\.(?<domain>.+)$;
return 301 $scheme://$domain$request_uri;
}
map $host $domain {
~^www\.(.+) $1;
}
server {
listen 80;
listen [::]:80;
server_name www.*;
return 301 $scheme://$domain$request_uri;
}
server {
listen *:80;
server_name www.site.ru site.ru ;
root /var/www/site.ru/web;
.........
server {
listen *:443;
server_name www.site.ru site.ru ;
root /var/www/site.ru/web;
.........