Nginx global variable Instance control rewrite reference manual

Source: Internet
Author: User

HTTP://DWZ.STAMHE.COM/INDEX.PHP?_A=INDEX&_M=SHOW&COUNT=10REMOTE_ADDR client IP, such as: 192.168.4.2binary_remote_ Addr Client IP (binary) Remote_port client port, such as: 50472remote_user has passed auth Basic module authenticated username host header field, otherwise the server name, such as: Dwz.stamhe.comrequest user request information, such as: GET/?_a=index&_m=show&count=10 http/1.1request_filename The path name of the file currently requested, A combination of root or alias and URI request, such as the response status code of the/webserver/htdocs/dwz/index.phpstatus request, such as the number of body bytes sent when the 200body_bytes_sent response. Even if the connection is interrupted, the data is accurate, such as the Content-length field in the 40content_length request header content_type The Content-type field in the request header http_referer the reference address HTTP_ User_agent Client Agent information, such as: mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/536.11 (khtml, like Gecko) chrome/20.0.1132.57 Safari/536.11args such as: _a=index&_m=show&count= 10document_uri is the same as $uri, such as:/index.phpdocument_root sets the value for the root path of the current request, such as:/webserver/htdocs/ Dwzhostname such as: Centos53.localdomainhttp_cookie client cookie Information Cookie_cookiecookie the value of the cookie variable Is_args if there is a $args parameter, this variable equals "?" , otherwise equal to "", null value, such as limit_rate this variable can limit the connection rate, 0 means unlimited speed query_string and $args the same, such as: _a=index&_m=show&count=10realpAth_root such as:/webserver/htdocs/dwzrequest_body record post data information Request_body_file client request principal information temporary file name Request_method client requested action , usually get or post, such as: Getrequest_uri contains the original URI of the request parameter, and does not contain the hostname, such as "/foo/bar.php?arg=baz". Cannot be modified. such as:/index.php?_a=index&_m=show&count=10schemehttp method (such as Http,https), such as: Httpuri such as:/index.phprequest_ Completion if the request ends, set to OK. When the request is not closed or if the request is not the last of the request chain, it is empty (empty), such as: The protocol used by the OKSERVER_PROTOCOL request, usually http/1.0 or http/1.1, such as: HTTP/1.1SERVER_ADDR server address, This value can be determined after a system call is completed, such as the 192.168.4.129server_name server name, such as: The port number of the Dwz.stamhe.comserver_port request to the server, such as: 80

Ext.: http://www.linuxidc.com/Linux/2015-06/119398.htm
Global Variables

The following is a global variable that can be used as an if judgment

  • $args: #这个变量等于请求行中的参数, with$query_string
  • $content_length: The Content-length field in the request header.
  • $content_type: The Content-type field in the request header.
  • $document_root: The value specified in the root instruction of the current request.
  • $host: Requests the Host header field, otherwise the server name.
  • $http_user_agent: Client Agent Information
  • $http_cookie: Client Cookie Information
  • $limit_rate: This variable can limit the connection rate.
  • $request_method: The action requested by the client, usually get or post.
  • $remote_addr: The IP address of the client.
  • $remote_port: The port of the client.
  • $remote_user: The user name that has been authenticated by the Auth Basic module.
  • $request_filename: The file path of the current request, generated by a root or alias instruction with a URI request.
  • $scheme: HTTP method (such as Http,https).
  • $server_protocol: The protocol used by the request, usually http/1.0 or http/1.1.
  • $server_addr: The server address, which can be determined after a system call is completed.
  • $server_name: Server name.
  • $server_port: The port number on which the request reached the server.
  • $request_uri: Contains the original URI of the request parameter, and does not contain the hostname, such as: "/foo/bar.php?arg=baz".
  • $uri: The current URI without the request parameter, $uri does not contain a hostname, such as "/foo/bar.html".
  • $document_uri: Same as $uri.

Cases:http://localhost:88/test1/test2/test.php

  1. $host:localhost
  2. $server_port:88
  3. $request_uri:http://localhost:88/test1/test2/test.php
  4. $document_uri:/test1/test2/test.php
  5. $document_root:/var/www/html
  6. $request_filename:/var/www/html/test1/test2/test.php

Nginx global variable Instance control rewrite reference manual

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.