server {
listen 80;
server_name ~^(www\.)?((?<sd>.+)\.)?my\.com&;
return 301 http://my.com/$sd$request_uri;
}
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name my.com;
access_log /var/log/nginx/artzub.access.log main;
error_log /var/log/nginx/artzub.error.log info;
root /var/www;
location / {
index index.html index.htm;
}
location ~* \.(?:jpg|ico|gif|png|css|js|svg)$ {
access_log off;
expires 30d;
}
}
server {
listen 80;
server_name ~^(www\.)?((?<sd>.+)\.)?my\.com&;
return 301 http://my.com/$sd$request_uri;
}
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name my.com;
access_log /var/log/nginx/artzub.access.log main;
error_log /var/log/nginx/artzub.error.log info;
root /var/www;
location / {
index index.html index.htm;
}
location ~* \.(?:jpg|ico|gif|png|css|js|svg)$ {
access_log off;
expires 30d;
}
}
server {
listen 80;
server_name ~^(.*)\.my\.com$;
set $sd $1;
if ($sd = "www") {
set $sd "";
}
rewrite_log on;
rewrite ^ http://my.com/$sd$request_uri? permanent;
}
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name my.com;
access_log /var/log/nginx/artzub.access.log main;
error_log /var/log/nginx/artzub.error.log info;
root /var/www;
location / {
index index.html index.htm;
}
location ~* \.(jpg|ico|gif|png|css|js|svg)$ {
access_log off;
expires 30d;
}
}
server {
listen 80;
server_name ~^(.*)\.my\.com$;
set $sd $1;
if ($sd = "www") {
set $sd "";
}
rewrite_log on;
rewrite ^ http://my.com/$sd$request_uri? permanent;
}
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name my.com;
access_log /var/log/nginx/artzub.access.log main;
error_log /var/log/nginx/artzub.error.log info;
root /var/www;
location / {
index index.html index.htm;
}
location ~* \.(jpg|ico|gif|png|css|js|svg)$ {
access_log off;
expires 30d;
}
}