No, simply doing server_name ~^(?<account>.+)\.mydomain\.com$; Works. This may be a bug with nginx? The new regular expression is valid and should work. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,236870,236881#msg-236881