comparison xml/en/docs/http/request_processing.xml @ 148:682163f2b298

Unified article/path and module/pathname into a single "path". "path" no longer emits double quotes so preserve them where needed. Replaced some misuses of "path" and "dirname".
author Ruslan Ermilov <ru@nginx.com>
date Tue, 25 Oct 2011 13:28:36 +0000
parents 7db449e89e92
children 4c6d2c614d2c
comparison
equal deleted inserted replaced
147:8057b7793bd9 148:682163f2b298
199 </para> 199 </para>
200 200
201 <para> 201 <para>
202 nginx first searches for the most specific location given by literal strings 202 nginx first searches for the most specific location given by literal strings
203 regardless of the listed order. In the configuration above 203 regardless of the listed order. In the configuration above
204 the only literal location is <path>/</path> and since it matches 204 the only literal location is “<code>/</code>” and since it matches
205 any request it will be used as a last resort. 205 any request it will be used as a last resort.
206 Then nginx checks locations given by 206 Then nginx checks locations given by
207 regular expression in the order listed in the configuration file. 207 regular expression in the order listed in the configuration file.
208 The first matching expression stops the search and nginx will use this 208 The first matching expression stops the search and nginx will use this
209 location. If no regular expression matches a request, then nginx uses 209 location. If no regular expression matches a request, then nginx uses
233 233
234 <list> 234 <list>
235 235
236 <item> 236 <item>
237 <para> 237 <para>
238 A request <path>/logo.gif</path> is matched by the literal location 238 A request “<code>/logo.gif</code>” is matched by the literal location
239 <dirname>/</dirname> first and then by the regular expression 239 “<code>/</code>” first and then by the regular expression
240 <dirname>\.(gif|jpg|png)$</dirname>, 240 “<code>\.(gif|jpg|png)$</code>”,
241 therefore, it is handled by the latter location. 241 therefore, it is handled by the latter location.
242 Using the directive <dirname>root&nbsp;/data/www</dirname> the request 242 Using the directive “<code>root&nbsp;/data/www</code>” the request
243 is mapped to a file <path>/data/www/logo.gif</path>, and the file 243 is mapped to a file <path>/data/www/logo.gif</path>, and the file
244 is sent to the client. 244 is sent to the client.
245 </para> 245 </para>
246 </item> 246 </item>
247 247
248 <item> 248 <item>
249 <para> 249 <para>
250 A request <path>/index.php</path> is also matched by the literal location 250 A request “<code>/index.php</code>” is also matched by the literal location
251 <dirname>/</dirname> first and then by the regular expression 251 “<code>/</code>” first and then by the regular expression
252 <dirname>\.(php)$</dirname>. Therefore, it is handled by the latter location 252 “<code>\.(php)$</code>”. Therefore, it is handled by the latter location
253 and the request is passed to a FastCGI server listening on localhost:9000. 253 and the request is passed to a FastCGI server listening on localhost:9000.
254 The <dirname>fastcgi_param</dirname> directive sets the FastCGI parameter 254 The <dirname>fastcgi_param</dirname> directive sets the FastCGI parameter
255 SCRIPT_FILENAME to <path>/data/www/index.php</path>, 255 SCRIPT_FILENAME to “<code>/data/www/index.php</code>”,
256 and the FastCGI server executes the file. 256 and the FastCGI server executes the file.
257 The variable $document_root is equal to 257 The variable $document_root is equal to
258 the value of the <dirname>root</dirname> directive and 258 the value of the <dirname>root</dirname> directive and
259 the variable $fastcgi_script_name is equal to the request URI, 259 the variable $fastcgi_script_name is equal to the request URI,
260 i.e. <path>/index.php</path>. 260 i.e. “<code>/index.php</code>”.
261 </para> 261 </para>
262 </item> 262 </item>
263 263
264 <item> 264 <item>
265 <para> 265 <para>
266 A request <path>/about.html</path> is matched by the literal location 266 A request “<code>/about.html</code>” is matched by the literal location
267 <dirname>/</dirname> only, therefore, it is handled in this location. 267 “<code>/</code>” only, therefore, it is handled in this location.
268 Using the directive <dirname>root /data/www</dirname> the request is mapped 268 Using the directive “<code>root /data/www</code>” the request is mapped
269 to the file <path>/data/www/about.html</path>, and the file is sent 269 to the file <path>/data/www/about.html</path>, and the file is sent
270 to the client. 270 to the client.
271 </para> 271 </para>
272 </item> 272 </item>
273 273
274 <item> 274 <item>
275 <para> 275 <para>
276 Handling a request <path>/</path> is more complex. 276 Handling a request “<code>/</code>” is more complex.
277 It is matched by the literal location <dirname>/</dirname> only, 277 It is matched by the literal location “<code>/</code>” only,
278 therefore, it is handled by this location. 278 therefore, it is handled by this location.
279 Then the <dirname>index</dirname> directive tests for the existence 279 Then the <dirname>index</dirname> directive tests for the existence
280 of an index file according to its parameters and 280 of an index file according to its parameters and
281 the <dirname>root&nbsp;/data/www</dirname> directive. 281 the “<code>root&nbsp;/data/www</code>” directive.
282 If a file <path>/data/www/index.php</path> exists, 282 If a file <path>/data/www/index.php</path> exists,
283 then the directive does an internal redirect to <path>/index.php</path>, and 283 then the directive does an internal redirect to “<code>/index.php</code>”, and
284 nginx searches the locations again as if the request had been sent by a client. 284 nginx searches the locations again as if the request had been sent by a client.
285 As we saw before, the redirected request will eventually be handled 285 As we saw before, the redirected request will eventually be handled
286 by the FastCGI server. 286 by the FastCGI server.
287 </para> 287 </para>
288 </item> 288 </item>