A catch-all and named server in a single configuration

Matthijs Langenberg mlangenberg at gmail.com
Fri Jun 13 14:37:59 MSD 2008


Hi all,

I want to setup a catch-all server for all domains referred to that
ip. (It should pass various domains to a rails app).
Therefore I use:

server {
  server_name _;
  ## do some stuff
}

Now I there is one exception for this, there is a special domain where
I want a directory listing for so I added another server entry:

server {
  server_name exceptional_domain.com
  ## do some dir listing stuff
}

server {
  server_name _*;
  ## do some stuff
}

After restarting nginx, all domains where caught in the first entry,
showing the dir listing! None of the domains hit rails anymore!
I solved the problem by adding a conditions to the catch-all entry,
which is pretty ugly when I want to add some additional vhosts, but
it'll do for now.

Is this behavior a bug, or is it intended?

- Matt

p.s. this is nginx-0.4.13-2 on debian etch





More information about the nginx mailing list