一、官方介绍

官方资料:
http://nginx.org/en/docs/http/ngx_http_core_module.html#var_uri
http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri

问答资料:
https://stackoverflow.com/questions/48708361/nginx-request-uri-vs-uri/48709976

二、摘要

$request_uri

This variable is equal to the original request URI as received from the client including the args. It cannot be modified. Look at $uri for the post-rewrite/altered URI. Does not include host name. Example: "/foo/bar.php?arg=baz"

这个变量等于从客户端发送来的原始请求URI(最原始的),包括参数,它不可以进行修改。$uri变量反映的是重写后/改变的URI(最终的),不包括主机名。例如:"/foo/bar.php?arg=baz"

$uri

This variable is the current request URI, without any arguments (see $args for those). This variable will reflect any modifications done so far by internal redirects or the index module. Note this may be different from $request_uri, as $request_uri is what was originally sent by the browser before any such modifications. Does not include the protocol or host name. Example: /foo/bar.html

这个变量指当前的请求URI,不包括任何参数(见$args)。这个变量反映任何内部重定向或index模块所做的修改。注意,这和$request_uri不同,因$request_uri是浏览器发起的不做任何修改的原生URI。不包括协议及主机名。例如:"/foo/bar.html"

$document_uri 同 $uri.

二、示例
案例1:
访问:http://127.0.0.1/test/

$uri:/test/test.html
$request_uri:/test/

案例2:
访问:http://127.0.0.1/

$uri:/index.html
$request_uri:/

案例3(服务器上不存在res目录):
访问:http://127.0.0.1/res

$uri:/res
$request_uri:/res