Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

This is my config file for nginx to allow it to respond only to, and not

server {
    root /var/www/;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_redirect off;

However this is still listening on What am I missing here? Any help is appreciated.

share|improve this question
up vote 1 down vote accepted

This is not possible, at least not this way. If the server receives a request with a Host header for a domain that is configured in no server_name statement, it will fall back to a default server, even if the server_name does not match.

See the documentation for more info on the fallback order.

share|improve this answer

Yep SvenW is correct, you need to set up a default vhost, possibly just set it to return a 404 if that's desired behaviour, or some sort of holding page.

share|improve this answer

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.