

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in ru.sysoev.nginxserver_name not working as intended ?| From | Sent On | Attachments |
|---|---|---|
| Brice Figureau | Apr 24, 2007 6:35 am | |
| Igor Sysoev | Apr 24, 2007 8:12 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | server_name not working as intended ? | Actions... |
|---|---|---|
| From: | Brice Figureau (bric...@public.gmane.org) | |
| Date: | Apr 24, 2007 6:35:59 am | |
| List: | ru.sysoev.nginx | |
Hi,
I'm discovering nginx, and it is a really good product. I'm willing to replace my old heavly patched thttpd with nginx, but I'm stumbling accross the following issue:
... http { access_log /var/log/nginx/access.log; server { listen 8095; server_name www.domain1.com; root /var/www/www.domain1.com; } server { listen 8095; server_name www.domain2.com *; root /var/www/www.domain2.com; } } ...
The intended behavior is that any request for www.domain1.com will be served from /var/www/www.domain1.com and every _other_ requests have to be server from /var/www/www.domain2.com (including those reqeusts with $http_host=www.domain2.com).
But, nginx (currently running 0.5.16), does serve any requests other than www.domain1.com or www.domain2.com from the first virtual host (the one whose root is /var/www/www.domain1.com). Request with a defined (in a server_name) http host are served from their respective virtual host.
It all appears as if the '*' in the second server_name was attributed to the first virtual host and not the second one.
In the following example: anything.domain1.com, www.domain1.com are resolving to the same IP address.
Extract of error.log (non-working):
...
2007/04/24 15:26:43 [debug] 6047#0: *15 http request line: "GET /nginx.txt
HTTP/1.1"
2007/04/24 15:26:43 [debug] 6047#0: *15 http uri: "/nginx.txt"
2007/04/24 15:26:43 [debug] 6047#0: *15 http args: ""
2007/04/24 15:26:43 [debug] 6047#0: *15 http exten: "txt"
2007/04/24 15:26:43 [debug] 6047#0: *15 http process request header line
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Host:
anything.domain1.com:8095"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "User-Agent: Mozilla/5.0
(X11; U; Linux i686; en-US; rv:1.8.0.11) Gecko/20070324 (Debian-1.8.0.11-2)
Galeon/2.0.2 (Debian package 2.0.2-4)"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Accept-Language: en"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Accept-Encoding:
gzip,deflate"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Accept-Charset:
ISO-8859-15,utf-8;q=0.7,*;q=0.7"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Keep-Alive: 300"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header: "Connection: keep-alive"
2007/04/24 15:26:43 [debug] 6047#0: *15 http header done
2007/04/24 15:26:43 [debug] 6047#0: *15 event timer del: 3: 600223917
2007/04/24 15:26:43 [debug] 6047#0: *15 generic phase: 0
2007/04/24 15:26:43 [debug] 6047#0: *15 generic phase: 1
2007/04/24 15:26:43 [debug] 6047#0: *15 find location for "/nginx.txt"
2007/04/24 15:26:43 [debug] 6047#0: *15 using configuration ""
2007/04/24 15:26:43 [debug] 6047#0: *15 http cl:-1 max:1048576
2007/04/24 15:26:43 [debug] 6047#0: *15 generic phase: 3
2007/04/24 15:26:43 [debug] 6047#0: *15 post rewrite phase: 4
2007/04/24 15:26:43 [debug] 6047#0: *15 generic phase: 5
2007/04/24 15:26:43 [debug] 6047#0: *15 generic phase: 6
2007/04/24 15:26:43 [debug] 6047#0: *15 access phase: 7
2007/04/24 15:26:43 [debug] 6047#0: *15 access phase: 8
2007/04/24 15:26:43 [debug] 6047#0: *15 post access phase: 9
2007/04/24 15:26:43 [debug] 6047#0: *15 content phase: 10
2007/04/24 15:26:43 [debug] 6047#0: *15 content phase: 11
2007/04/24 15:26:43 [debug] 6047#0: *15 content phase: 12
2007/04/24 15:26:43 [debug] 6047#0: *15 http set discard body
2007/04/24 15:26:43 [debug] 6047#0: *15 http filename:
"/var/www/www.domain1.com/nginx.txt"
...
Extract of error.log:
...
2007/04/24 15:28:56 [debug] 6047#0: *16 http request line: "GET /nginx.txt
HTTP/1.1"
2007/04/24 15:28:56 [debug] 6047#0: *16 http uri: "/nginx.txt"
2007/04/24 15:28:56 [debug] 6047#0: *16 http args: ""
2007/04/24 15:28:56 [debug] 6047#0: *16 http exten: "txt"
2007/04/24 15:28:56 [debug] 6047#0: *16 http process request header line
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Host:
www.domain2.com:8095"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "User-Agent: Mozilla/5.0
(X11; U; Linux i686; en-US; rv:1.8.0.11) Gecko/20070324 (Debian-1.8.0.11-2)
Galeon/2.0.2 (Debian package 2.0.2-4)"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Accept-Language: en"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Accept-Encoding:
gzip,deflate"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Accept-Charset:
ISO-8859-15,utf-8;q=0.7,*;q=0.7"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Keep-Alive: 300"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header: "Connection: keep-alive"
2007/04/24 15:28:56 [debug] 6047#0: *16 http header done
2007/04/24 15:28:56 [debug] 6047#0: *16 event timer del: 3: 600357295
2007/04/24 15:28:56 [debug] 6047#0: *16 generic phase: 0
2007/04/24 15:28:56 [debug] 6047#0: *16 generic phase: 1
2007/04/24 15:28:56 [debug] 6047#0: *16 find location for "/nginx.txt"
2007/04/24 15:28:56 [debug] 6047#0: *16 using configuration ""
2007/04/24 15:28:56 [debug] 6047#0: *16 http cl:-1 max:1048576
2007/04/24 15:28:56 [debug] 6047#0: *16 generic phase: 3
2007/04/24 15:28:56 [debug] 6047#0: *16 post rewrite phase: 4
2007/04/24 15:28:56 [debug] 6047#0: *16 generic phase: 5
2007/04/24 15:28:56 [debug] 6047#0: *16 generic phase: 6
2007/04/24 15:28:56 [debug] 6047#0: *16 access phase: 7
2007/04/24 15:28:56 [debug] 6047#0: *16 access phase: 8
2007/04/24 15:28:56 [debug] 6047#0: *16 post access phase: 9
2007/04/24 15:28:56 [debug] 6047#0: *16 content phase: 10
2007/04/24 15:28:56 [debug] 6047#0: *16 content phase: 11
2007/04/24 15:28:56 [debug] 6047#0: *16 content phase: 12
2007/04/24 15:28:56 [debug] 6047#0: *16 http set discard body
2007/04/24 15:28:56 [debug] 6047#0: *16 http filename:
"/var/www/www.domain2.com/nginx.txt"
...
Any idea ? Thanks,
-- Brice Figureau <brice+ngin...@public.gmane.org>







