Mercurial > hg > nginx-site
changeset 173:6b81a1950ecb
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.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 07 Nov 2011 08:46:15 +0000 |
parents | 5e8e63f73c33 |
children | 69c131b0ebe0 |
files | xml/en/docs/http/ngx_http_core_module.xml |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 +<link id="root"/> and <link id="alias"/> directives) and the +<argument>file</argument> argument. It is possible to check the directory existence by specifying a slash at the end of a name, e.g. “<code>$uri/</code>”. If none of the files were found, an internal redirect to the <argument>uri</argument> specified by the last argument is made. +For example: +<example> +location /images/ { + try_files $uri /images/default.gif; +} + +location = /images/default.gif { + expires 30s; +} +</example> +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 <argument>code</argument>: <example>