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'm using nginx and I follow a simple tutorial to create vhosts. My problem is that if someone point his DNS to my server, nginx seems to not care about the server_name directive.

I have:

  listen          80;

I only have ONE vhost. If I set the DNS of to my server, nginx responds with a 200 page! How is it possible? I don't have that vhost configured on my server.

How do I ONLY allow the domains I have configured into server { }?

I'm using nginx version 0.7.67 on Ubuntu Maverick.

share|improve this question

migrated from Sep 17 '11 at 22:39

This question came from our site for professional and enthusiast programmers.

Is it not like apache and just pick the default (first) configuration? If you don't want people to forward their domain to your server, make two or more virtual hosts, the first one pointing to an error page, and then any request for a domain not hosted by you will return an error.

share|improve this answer
and make that first vhost a default (listen 80 default;) – sendmoreinfo Feb 3 '12 at 15:38

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.