Okay for it to work you need to do 2 things:
First, set up your A record on your DNS so its host is * and it points to your server IP
Then, in your NGINX config file for the site you just need to change:
server_name mydomain.com;
to
server_name .mydomain.com;
Notice the . before the domain name. It should then work (might take a little time for the DNS to recognize it, but worked).