Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_core_module.xml @ 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 |
comparison
equal
deleted
inserted
replaced
172:5e8e63f73c33 | 173:6b81a1950ecb |
---|---|
2052 | 2052 |
2053 <para> | 2053 <para> |
2054 Checks the existence of files in the specified order, and uses | 2054 Checks the existence of files in the specified order, and uses |
2055 the first found file for request processing; the processing | 2055 the first found file for request processing; the processing |
2056 is performed in the current context. | 2056 is performed in the current context. |
2057 A path to the file is a concatenation of the prefix (as controlled by the | |
2058 <link id="root"/> and <link id="alias"/> directives) and the | |
2059 <argument>file</argument> argument. | |
2057 It is possible to check the directory existence by specifying | 2060 It is possible to check the directory existence by specifying |
2058 a slash at the end of a name, e.g. “<code>$uri/</code>”. | 2061 a slash at the end of a name, e.g. “<code>$uri/</code>”. |
2059 If none of the files were found, an internal redirect to the | 2062 If none of the files were found, an internal redirect to the |
2060 <argument>uri</argument> specified by the last argument is made. | 2063 <argument>uri</argument> specified by the last argument is made. |
2064 For example: | |
2065 <example> | |
2066 location /images/ { | |
2067 try_files $uri /images/default.gif; | |
2068 } | |
2069 | |
2070 location = /images/default.gif { | |
2071 expires 30s; | |
2072 } | |
2073 </example> | |
2074 The last argument can also point to a named location, | |
2075 see examples below. | |
2061 As of version 0.7.51, the last argument can also be a | 2076 As of version 0.7.51, the last argument can also be a |
2062 <argument>code</argument>: | 2077 <argument>code</argument>: |
2063 <example> | 2078 <example> |
2064 location / { | 2079 location / { |
2065 try_files $uri $uri/index.html $uri.html =404; | 2080 try_files $uri $uri/index.html $uri.html =404; |