Welcome! Log In Create A New Profile

Advanced

default virtual host overrides all other virtual hosts

October 30, 2013 03:55AM
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.
SubjectAuthorPosted

default virtual host overrides all other virtual hosts

antjkennedyOctober 30, 2013 03:55AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready