SOLVED: if ($host ~* "([^\.\/]+\.[^\.\/]+)" ) { set $root /www/$1/www/root; } if ($host ~* "([^\/]+)\.([^\.\/]+\.[^\.\/]+)" ) { set $root /www/$2/$1/root; } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://nginx.org/pipermail/nginx/attachments/20080324/cbccef34/attachment.html>