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