server {
listen 80;
server_name example.com *.example.com;
root /var/www/platforms;
set $subdomain "";
if ($host ~* ^([a-z0-9-\.]+)\.example.com$) {
set $subdomain $1;
}
if ($host ~* ^www.example.com$) {
set $subdomain "";
}
}