Default virtual host overrides all other virtual hosts

hopefully someone can help, i’ve been trying to set up nginx with
virtual
hosts but the default host always overrides any of the others that i
specify.

here is my config file found in /etc/nginx/sites-enabled

server {
listen 80;
server_name sub.example.com;
return 404;
}

server {
listen 80 default;
server_name *.example.com;
return 501;
}

and the access.log shows

... - - [30/Oct/2013:04:09:11 +0400] “GET / HTTP/1.1” 501 582
http://sub.example.com/” “Mozilla/5.0 (Macintosh; Intel Mac OS X
10_9_0)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101
Safari/537.36”
... - - [30/Oct/2013:04:09:14 +0400] “GET / HTTP/1.1” 501 582
http://www.example.com/” “Mozilla/5.0 (Macintosh; Intel Mac OS X
10_9_0)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101
Safari/537.36”

thanks in advance for any help / ideas.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,244255,244255#msg-244255

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs