try_files and index

whiskybar nginx-forum at nginx.us
Mon Jun 25 23:00:55 UTC 2012


Why is it my first configuration returns 403 while my second
configuration returns 404?

I looked into logs and it seems my first configuration triggers the
index module which is set to the default index.html, finds nothing and
returns 403. Why isn't the =404 triggered? And why is the index module
triggered at all?

server {
    root /var;
    try_files $uri =404;
    location / {
    }
}

My second configuration works more like I expected; but then, why isn't
the index module triggered as well? Does try_files disable the index
module somehow?

server {
    root /var;
    location / {
        try_files $uri =404;
    }
}

Can someone explain how nginx goes to decide what to do?
Thank you

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,227887,227887#msg-227887



More information about the nginx mailing list