# HG changeset patch # User Ruslan Ermilov # Date 1320655575 0 # Node ID 6b81a1950ecbe18e60bed0f9057ee5e7212eaf6c # Parent 5e8e63f73c3370540a9c4e9d388ac4d2991247b3 Improved on "try_files" documentation: - documented that "root" and "alias" affect the path being checked; - provided an example of using a URI as the last argument; - documented that last argument can point to a named location. diff --git a/xml/en/docs/http/ngx_http_core_module.xml b/xml/en/docs/http/ngx_http_core_module.xml --- a/xml/en/docs/http/ngx_http_core_module.xml +++ b/xml/en/docs/http/ngx_http_core_module.xml @@ -2054,10 +2054,25 @@ send a file in full packets. Checks the existence of files in the specified order, and uses the first found file for request processing; the processing is performed in the current context. +A path to the file is a concatenation of the prefix (as controlled by the + and directives) and the +file argument. It is possible to check the directory existence by specifying a slash at the end of a name, e.g. “$uri/”. If none of the files were found, an internal redirect to the uri specified by the last argument is made. +For example: + +location /images/ { + try_files $uri /images/default.gif; +} + +location = /images/default.gif { + expires 30s; +} + +The last argument can also point to a named location, +see examples below. As of version 0.7.51, the last argument can also be a code: