# Default virtual server & server sequence in nginx.conf

**URL:** <https://www.ruby-forum.com/t/default-virtual-server-server-sequence-in-nginx-conf/165395>\
**Category:** NGINX\
**Created:** [April 13, 2009, 5:22pm UTC](https://www.ruby-forum.com/t/default-virtual-server-server-sequence-in-nginx-conf/165395 "2009-04-13T17:22:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f6c823/32.png) [@alf](https://www.ruby-forum.com/u/alf)\
**Post date:** [April 13, 2009, 5:22pm UTC](https://www.ruby-forum.com/t/default-virtual-server-server-sequence-in-nginx-conf/165395/1 "2009-04-13T17:22:07Z")

</div>

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](http://mydomain.com);  
index mydomain.html;  
}

server {  
listen 80 default;  
server\_name \_;  
index default.html;  
}

but now [mydomain.com](http://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:

> **[Default virtual server & server sequence in nginx.conf](https://forum.nginx.org/read.php?2,1013,1013#msg-1013)**
>
> 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 th

---

<div class="post-metadata">

**Author:** ![alf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f6c823/32.png) [@alf](https://www.ruby-forum.com/u/alf)\
**Post date:** [April 13, 2009, 5:45pm UTC](https://www.ruby-forum.com/t/default-virtual-server-server-sequence-in-nginx-conf/165395/2 "2009-04-13T17:45:33Z")

</div>

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](mailto:removed_email_address@domain.invalid)

>

---

<div class="post-metadata">

**Author:** ![alf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f6c823/32.png) [@alf](https://www.ruby-forum.com/u/alf)\
**Post date:** [April 13, 2009, 8:46pm UTC](https://www.ruby-forum.com/t/default-virtual-server-server-sequence-in-nginx-conf/165395/3 "2009-04-13T20:46:06Z")

</div>

I have always created seperate config file for each url. Have found this  
easier to manage and less errors

Posted at Nginx Forum:

> **[Re: Default virtual server & server sequence in nginx.conf](https://forum.nginx.org/read.php?2,1013,1021#msg-1021)**
>
> 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 th
