Hi,
I’m trying to figure out an issue with the include directive and
wildcards in v0.5.33 (on Ubuntu Hardy).
My nginx.conf file looks like so (trimmed):
http {
include /u/apps/*/current/config/nginx.conf;
}
Then, I have two directories within /u/apps, each with their own config:
/u/apps/bar/current/config/nginx.conf (trimmed):
server {
listen 80;
server_name _ *;
location / {
proxy_pass http://bar_mongrel;
}
}
/u/apps/foo/current/config/nginx.conf (trimmed):
server {
listen 80;
server_name foo.domain.com;
location {
proxy_pass http://foo_mongrel;
}
}
This code never reaches the bar server, it only ever returns foo.
However, when I change my nginx.conf to:
http {
include /u/apps/bar/current/config/nginx.conf;
include /u/apps/foo/current/config/nginx.conf;
}
… it works perfectly (and I change the order of those two and it
still works fine).
I’m wondering what I’m doing wrong here?
Thanks!
Ian
On Sat, Jun 28, 2008 at 07:43:35PM -0700, Ian Sefferman wrote:
/u/apps/bar/current/config/nginx.conf (trimmed):
listen 80;
include /u/apps/foo/current/config/nginx.conf;
}
… it works perfectly (and I change the order of those two and it
still works fine).
I’m wondering what I’m doing wrong here?
Wildcard includes are not sorted. Thus, probably, bar was included after
foo.
“server_name … *” is not default server, it’s ugly hack, and it had
been
removed in 0.6.x. The default server was alwayes set in listen
directive:
listen 80 default;
If you do not set it explicitly, it will be first server. So:
- listen 80;
- server_name _ *;
- listen 80 default;
- server_name _;
On 6/29/08, Igor S. [email protected] wrote:
so “_” in this context is basically “ignore the Host header” -
otherwise it wouldn’t work properly with multiple sites on the same IP
right?
On Sun, Jun 29, 2008 at 02:13:29AM -0700, mike wrote:
On 6/29/08, Igor S. [email protected] wrote:
so “_” in this context is basically “ignore the Host header” -
otherwise it wouldn’t work properly with multiple sites on the same IP
right?
Yes, “_” is invalid DNS name. But you may set in default server
some real default names.