Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a number of vhosts, and I'd like to "turn off" the default vhost, either by blank page, error page, or generally whatever is the most efficient use of Nginx's resources, whilst only allowing other vhosts to be access via pre-defined domains.

share|improve this question
up vote 15 down vote accepted

Define a default_server that returns an HTTP 444 code:

server {
    listen      80 default_server;
    server_name _;
    return      444;

(Returning a 4xx error code means requests can be interpreted by a client as an unsuccessful request, rather an HTTP 200 Blank Page But Totally Worked Trust Me.)

share|improve this answer
444 is a non-standard nginx specific code: "a special nginx’s non-standard code 444 is returned that closes the connection" – bzeaman Apr 13 at 9:39
This does not work for https. A simple listen 443 default_server won't work either as the ssl handshake happens first of all and nginx will error before returning 444. One solution I have yet to try but should work is to create a self signed certificate for the default https server and optinally redirect to http to avoid any browser errors. – Simon Bengtsson Jul 21 at 14:22

Just define default vhost that will point to directory with blank index.html file.

server {
    listen       80 default_server;
    server_name  _ ;
    root /var/www/placeholder ; 
    index index.html;

and place blank index in /var/www/placeholder

share|improve this answer
it will catch every request that does not hit any of your domainnames and response with blank page. – wojciechz Aug 23 '12 at 9:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.