Еще одни nginx переписывают вопрос о правиле:
Как я могу сделать переписывание от http://www.*.domain.com
кому: http://*.domain.com
?
if ($host ~* www\.(.*)) {
set $host_without_www $1;
rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
}
Ответ по ошибке сервера: https : //serverfault.com/questions/139579/nginx-subdomain-rewrite