nginx uri和request_uri区别

$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

The same as $uri.

nginx内置变量汇总:

Embedded Variables

The ngx_http_core_module module supports embedded variables with names matching the Apache Server variables. First of all, these are variables representing client request header fields, such as $http_user_agent$http_cookie, and so on. Also there are other variables:

$arg_name
argument name in the request line
$args
arguments in the request line
$binary_remote_addr
client address in a binary form, value’s length is always 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses
$body_bytes_sent
number of bytes sent to a client, not counting the response header; this variable is compatible with the “%B” parameter of the mod_log_config Apache module
$bytes_sent
number of bytes sent to a client (1.3.8, 1.2.5)
$connection
connection serial number (1.3.8, 1.2.5)
$connection_requests
current number of requests made through a connection (1.3.8, 1.2.5)
$content_length
“Content-Length” request header field
$content_type
“Content-Type” request header field
$cookie_name
the name cookie
$document_root
root or alias directive’s value for the current request
$document_uri
same as $uri
$host
in this order of precedence: host name from the request line, or host name from the “Host” request header field, or the server name matching a request
$hostname
host name
$http_name
arbitrary request header field; the last part of a variable name is the field name converted to lower case with dashes replaced by underscores
$https
on” if connection operates in SSL mode, or an empty string otherwise
$is_args
?” if a request line has arguments, or an empty string otherwise
$limit_rate
setting this variable enables response rate limiting; see limit_rate
$msec
current time in seconds with the milliseconds resolution (1.3.9, 1.2.6)
$nginx_version
nginx version
$pid
PID of the worker process
$pipe
p” if request was pipelined, “.” otherwise (1.3.12, 1.2.7)
$proxy_protocol_addr
client address from the PROXY protocol header, or an empty string otherwise (1.5.12)

The PROXY protocol must be previously enabled by setting the proxy_protocol parameter in the listen directive.

$proxy_protocol_port
client port from the PROXY protocol header, or an empty string otherwise (1.11.0)

The PROXY protocol must be previously enabled by setting the proxy_protocol parameter in the listen directive.

$query_string
same as $args
$realpath_root
an absolute pathname corresponding to the root or alias directive’s value for the current request, with all symbolic links resolved to real paths
$remote_addr
client address
$remote_port
client port
$remote_user
user name supplied with the Basic authentication
$request
full original request line
$request_body
request body

The variable’s value is made available in locations processed by the proxy_passfastcgi_pass,uwsgi_pass, and scgi_pass directives when the request body was read to a memory buffer.

$request_body_file
name of a temporary file with the request body

At the end of processing, the file needs to be removed. To always write the request body to a file,client_body_in_file_only needs to be enabled. When the name of a temporary file is passed in a proxied request or in a request to a FastCGI/uwsgi/SCGI server, passing the request body should be disabled by the proxy_pass_request_body offfastcgi_pass_request_body off,uwsgi_pass_request_body off, or scgi_pass_request_body off directives, respectively.

$request_completion
OK” if a request has completed, or an empty string otherwise
$request_filename
file path for the current request, based on the root or alias directives, and the request URI
$request_id
unique request identifier generated from 16 random bytes, in hexadecimal (1.11.0)
$request_length
request length (including request line, header, and request body) (1.3.12, 1.2.7)
$request_method
request method, usually “GET” or “POST
$request_time
request processing time in seconds with a milliseconds resolution (1.3.9, 1.2.6); time elapsed since the first bytes were read from the client
$request_uri
full original request URI (with arguments)
$scheme
request scheme, “http” or “https
$sent_http_name
arbitrary response header field; the last part of a variable name is the field name converted to lower case with dashes replaced by underscores
$sent_trailer_name
arbitrary field sent at the end of the response (1.13.2); the last part of a variable name is the field name converted to lower case with dashes replaced by underscores
$server_addr
an address of the server which accepted a request

Computing a value of this variable usually requires one system call. To avoid a system call, the listendirectives must specify addresses and use the bind parameter.

$server_name
name of the server which accepted a request
$server_port
port of the server which accepted a request
$server_protocol
request protocol, usually “HTTP/1.0”, “HTTP/1.1”, or “HTTP/2.0
$status
response status (1.3.2, 1.2.2)
$tcpinfo_rtt$tcpinfo_rttvar$tcpinfo_snd_cwnd$tcpinfo_rcv_space
information about the client TCP connection; available on systems that support the TCP_INFO socket option
$time_iso8601
local time in the ISO 8601 standard format (1.3.12, 1.2.7)
$time_local
local time in the Common Log Format (1.3.12, 1.2.7)
$uri
current URI in request, normalized

The value of $uri may change during request processing, e.g. when doing internal redirects, or when using index files.

时间: 2024-11-10 06:53:03

nginx uri和request_uri区别的相关文章

Nginx的$uri和$request_uri

$uri指的是请求的文件和路径,不包括"?"或者"#"之后的东西,$request_uri则是请求的整个字符串,包含了后面的query_string的. Nginx的$uri和$request_uri

PHP_SELF、 SCRIPT_NAME、 REQUEST_URI区别

PHP_SELF. SCRIPT_NAME. REQUEST_URI区别 $_SERVER[PHP_SELF], $_SERVER[SCRIPT_NAME], $_SERVER['REQUEST_URI'] 在用法上是非常相似的,他们返回的都是与当前正在使用的页面地址有关的信息,这里列出一些相关的例子,帮助确定哪些是在你的脚本最适合的. $_SERVER[’PHP_SELF’] http://www.yoursite.com/example/ — – — /example/index.php h

详谈Apache、Nginx和tomcat的区别以及处理静态页面和动态页面的方式

就目前来说,网站主要分为静态页面和动态页面,纯静态页面的网站已经比较少见了,大型网站一般使用的是静态页面+动态页面的建站技术,还有一部分网站是纯动态页面.负责处理这些页面的软件我们通常称之为web容器,是一种服务程序,负责处理客户端(浏览器)发来的访问请求,如果是静态页面会直接将文件内容呈现给客户端(浏览器),如果是动态页面会将其解析成静态内容之后再呈现给客户端(浏览器). 一.Apache.Nginx和tomcat的区别 ApacheApache HTTP Server(简称Apache)是A

nginx与tomcat的区别

nginx与tomcat的区别 nginx常用做静态内容服务和代理服务器,直面外来请求转发给后面的应用服务(tomcat,django等),tomcat更多用来做做一个应用容器,让javaweb app跑在里面的东西,对应同级别的有jboss,jetty等.严格的来说,Apache/Nginx 应该叫做HTTP Server:而Tomcat则是一个Application Server,或者更准确的来说,是一个Servlet/JSP应用的容器(Ruby/Python 等其他语言开发的应用也无法直接

nginx location 与 $request_uri 的匹配区别

举例  http://www.jastme.org/Handler/FileHandler.ashx?fid=207ec068-2571-404d-84cd-f4c2a475865f_152X152_1 我现在有这样一个需求 把http://www.jastme.org/Handler/FileHandler.ashx?fid=207ec068-2571-404d-84cd-f4c2a475865f_152X152_1 在nginx中重写成 http://www.jastme.org/Handl

详细解析 nginx uri 如何匹配 location 规则

location 是 nginx 配置中出现最频繁的配置项,一个 uri 是如何与多个 location 进行匹配的? 在有多个 location 都匹配的情况下,如何决定使用哪一个 location 作为匹配结果? 清晰内部机制之后,疑问自然迎刃而解. location 规则类型 根据官方文档,location 配置语法如下 Syntax: location [ = | ~ | ~* | ^~ ] uri { ... } location @name { ... } Default: - Co

详解 $_SERVER 函数中QUERY_STRING和REQUEST_URI区别

http://blog.sina.com.cn/s/blog_686999de0100jgda.html 实例: 1,http://localhost/aaa/ (打开aaa中的index.php)结果:$_SERVER['QUERY_STRING'] = "";$_SERVER['REQUEST_URI']  = "/aaa/";$_SERVER['SCRIPT_NAME']  = "/aaa/index.php";$_SERVER['PHP_

URI与URL区别

URL 与 URI 很多人会混淆这两个名词. URL:(Uniform/Universal Resource Locator 的缩写,统一资源定位符). URI:(Uniform Resource Identifier 的缩写,统一资源标识符)(代表一种标准). 关系: URI 属于 URL 更高层次的抽象,一种字符串文本标准. 就是说,URI 属于父类,而 URL 属于 URI 的子类.URL 是 URI 的一个子集. 二者的区别在于,URI 表示请求服务器的路径,定义这么一个资源.而 URL

nginx与apache的区别及优缺点比较

本文绝大多数资料都是摘抄网上,自己做的只就是整合网上零散的资源然后加上自己的一点见解.简单的说apache httpd和nginx都是web服务器,但两者适应的场景不同,也就是两者专注于解决不同的问题.apache httpd:稳定.对动态请求处理强,但同时高并发时性能较弱,耗费资源多.nginx:高并发处理能力强.擅长处理静态请求.反向代理.均衡负载.  1.nginx相对于apache的优点:轻量级,同样起web服务,比apache占用更少的内存及资源,并发能力强,nginx处理请求是异步非