Given I use this method for sub-domains map $http_host $subdir { hostnames; default "default"; .foo.bar.com "foo"; .baz.bar.com "baz"; } Is there a method to redirect any requests for sub-domains which do not exist (404s) to a custom html/php page? Posted at Nginx Forum: http://forum.nginx.org/read.php?2,218617,218634#msg-218634