Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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;
  server_name     www.domain.com;

I only have ONE vhost. If I set the DNS of example.com 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 stackoverflow.com Sep 17 '11 at 22:39

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

1 Answer 1

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
1  
and make that first vhost a default (listen 80 default;) –  sendmoreinfo Feb 3 '12 at 15:38

Your Answer

 
discard

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.