Forum: NGINX Default virtual server & server sequence in nginx.conf

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
alf (Guest)
on 2009-04-13 19:22
(Received via mailing list)
Hello :)

I have been trying to wrap my head around this, read a lot of docs, but
I just cant seem to understand, so if anyone could enlighten me.

My example:

I want to set up a default virtual server (vhost) and a spesific vhost.

1. Does the sequence of these two server blocks in the nginx.conf
matter?

2. I tried something like this:

server {
  listen 80;
  server_name  mydomain.com;
  index mydomain.html;
}

server {
  listen 80 default;
  server_name  _;
  index default.html;
}

but now mydomain.com allways shows default.html. if i remove "default"
and put that same (the second) server on the top it all works fine..

I would really like to know what is really going on here behind the
scenes, any info much apresiated.

alf :)

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1013,1013#msg-1013
Delta Y. (Guest)
on 2009-04-13 19:45
(Received via mailing list)
If the HOST header is OK when you do your test, then please try 0.7.51.
There is a bug  of server_name issue fixed in 0.7.51

2009/4/13 alf <removed_email_address@domain.invalid>

>
>
SSSlippy (Guest)
on 2009-04-13 22:46
(Received via mailing list)
I have always created seperate config file for each url. Have found this
easier to manage and less errors

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1013,1021#msg-1021
This topic is locked and can not be replied to.