I have the following nginx server defined (lots of irrelevant parts removed):
server { listen 80; server_name mydomain.com *.mydomain.com; location ~