Nginx 0.8.54: Index files bug?
Maxim Dounin
mdounin at mdounin.ru
Fri Feb 11 19:09:03 MSK 2011
Hello!
On Fri, Feb 11, 2011 at 10:43:19AM -0500, Dayo wrote:
> Hi Maxim!
>
> Maxim Dounin Wrote:
> -------------------------------------------------------
> > Hello!
> > It should log something like "rewrite or internal
> > redirection
> > cycle" at "error" level. Obviously enough your
> > config creates an
> > infinite loop on processing "/" as you set
> > try_files's fallback to
> > effectively the same uri, just with extra "/"
> > added.
> >
> > No idea why you have no logs - most likely you did
> > something wrong
> > (e.g. nginx has no access rights to write the file
> > in question and
> > config wasn't actually loaded due to this error,
> > but you've
> > overlooked related messages in global error_log).
>
> The error log file does log other errors.
This is fine, but doesn't explain why don't see the one in
question. It's hard to say anything without seeing the full
config.
> > This one should use index.html as an index (and
> > fallback to @proxy
> > if no index.html found or there is no directory at
> > all).
> Correct. It only works because it is falling back to apache.
>
> Did you see my previous post?
> When I comment out the try files directive, the index works.
Again:
location / {
try_files $uri $uri/;
}
is an infinite loop. It is expected to generate 500 for
directories. Under no conditions it will allow index to work.
This is what you wrote in your config: check if file (not
directory) "$uri" exists, if not - do internal redirect to
"$uri/".
If you want nginx to return 404 if no file or directory exists -
use
location / {
try_files $uri $uri/ =404;
}
Or, better, just don't use try_files - it's not needed here.
Index and static modules will generate 404 as appropriate.
Maxim Dounin
More information about the nginx
mailing list