<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 13, 2014 at 4:25 PM, Valentin V. Bartenev <span dir="ltr"><<a href="mailto:vbart@nginx.com" target="_blank">vbart@nginx.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Saturday 13 December 2014 15:53:32 neubyr wrote:<br>
[..]<br>
<span class="">> Thank you for pointing out debugging log. I think that helped in explaining<br>
> this behavior.<br>
><br>
> It seems like nginx is adding slash as uri name matches with corresponding<br>
> directory and not file name. I thought nginx will return 404 in this case,<br>
> but it adds trailing slash when matching directory is found.<br>
><br>
> After adding trailing slash uri becomes /test/ and hence it matches next<br>
> location block.<br>
><br>
> Hope my understanding of debugging log is correct. Let me know if I  am<br>
> missing anything.<br>
</span>[..]<br>
<br>
>From the debug log it looks like that you have the try_files directive<br>
in your "/test" location block.  And the config you have mentioned before<br>
isn't the one you are actually using.<br>
<br>
  wbr, Valentin V. Bartenev<br>
<div class=""><div class="h5"><br><br></div></div></blockquote><div><br></div><div>Thanks for pointing it out. It's giving same result even without try_files directive in '/test' location block. </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>2014/12/14 07:33:09 [debug] 16414#0: epoll: fd:6 ev:0001 d:00007F1B949F4010</div><div>2014/12/14 07:33:09 [debug] 16414#0: accept on <a href="http://0.0.0.0:80">0.0.0.0:80</a>, ready: 0</div><div>2014/12/14 07:33:09 [debug] 16414#0: posix_memalign: 00007F1B965F9440:256 @16</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 accept: 50.136.134.241 fd:3</div><div>2014/12/14 07:33:09 [debug] 16414#0: posix_memalign: 00007F1B96614070:256 @16</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 event timer add: 3: 60000:1418542449679</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 reusable connection: 1</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 epoll add event: fd:3 op:1 ev:80002001</div><div>2014/12/14 07:33:09 [debug] 16414#0: timer delta: 112608</div><div>2014/12/14 07:33:09 [debug] 16414#0: posted events 0000000000000000</div><div>2014/12/14 07:33:09 [debug] 16414#0: worker cycle</div><div>2014/12/14 07:33:09 [debug] 16414#0: epoll timer: 60000</div><div>2014/12/14 07:33:09 [debug] 16414#0: epoll: fd:3 ev:0001 d:00007F1B949F41C1</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http wait request handler</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 malloc: 00007F1B96588C90:1024</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 recv: fd:3 77 of 1024</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 reusable connection: 0</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 posix_memalign: 00007F1B965D3EE0:4096 @16</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http process request line</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http request line: "GET /test HTTP/1.1"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http uri: "/test"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http args: ""</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http exten: ""</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http process request header line</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http header: "User-Agent: curl/7.30.0"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http header: "Host: <a href="http://example.org">example.org</a>"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http header: "Accept: */*"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http header done</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 event timer del: 3: 1418542449679</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 generic phase: 0</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 rewrite phase: 1</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 test location: "/50x.html"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 test location: "/test"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 using configuration "/test"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http cl:-1 max:1048576</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 rewrite phase: 3</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 post rewrite phase: 4</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 generic phase: 5</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 generic phase: 6</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 generic phase: 7</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 generic phase: 8</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 access phase: 9</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 access phase: 10</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 post access phase: 11</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 try files phase: 12</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 content phase: 13</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 content phase: 14</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 content phase: 15</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 content phase: 16</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 content phase: 17</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 content phase: 18</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http filename: "/usr/share/nginx/test/test"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 add cleanup: 00007F1B965D4E98</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http static fd: -1</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http dir</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 posix_memalign: 00007F1B96595200:4096 @16</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http finalize request: 301, "/test?" a:1, c:1</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http special response: 301, "/test?"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http set discard body</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 xslt filter header</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 HTTP/1.1 301 Moved Permanently</div><div>Server: nginx/1.6.2</div><div>Date: Sun, 14 Dec 2014 07:33:09 GMT</div><div>Content-Type: text/html</div><div>Content-Length: 184</div><div>Location: <a href="http://example.org/test/">http://example.org/test/</a></div><div>Connection: keep-alive</div><div><br></div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 write new buf t:1 f:0 00007F1B965952A0, pos 00007F1B965952A0, size: 196 file: 0, size: 0</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http write filter: l:0 f:0 s:196</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http output filter "/test?"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 http copy filter: "/test?"</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 image filter</div><div>2014/12/14 07:33:09 [debug] 16414#0: *2 xslt filter body</div></div><div><br></div><div><br></div><div><br></div><div>- N</div></div></div></div>