catch a non existant subdomain with nginx or apache 2?

view story

http://serverfault.com – Is it possible to detect a non existant subdomain inside a "catch all" setup? user1.domain.ltd works user2.domain.ltd works nonexistant.domain.ltd does not work would like to redirect this to default.domain.ltd are there any ways to do this? *I need a serverside way to detect if a subdomain is non existant to show a default one * (HowTos)