nginx常用全域性變數表

2021-09-29 04:59:12 字數 1174 閱讀 1232

變數    說明

$args    請求中的引數,如www.test.com/1.php?a=1&b=2的$args就是a=1&b=2

$content_length    http請求資訊裡的"content-length"

$conten_type    http請求資訊裡的"content-type"

$document_root    nginx虛擬主機配置檔案中的root引數對應的值

$document_uri    當前請求中不包含指令的uri,如www.123.com/1.php?a=1&b=2的$document_uri就是1.php,不包含後面的引數

$host    主機頭,也就是網域名稱

$http_user_agent    客戶端的詳細資訊,也就是瀏覽器的標識,用curl -a可以指定

$http_cookie    客戶端的cookie資訊

$limit_rate    如果nginx伺服器使用limit_rate配置了顯示網路速率,則會顯示,如果沒有設定, 則顯示0

$remote_addr    客戶端的公網ip

$remote_port    客戶端的port

$remote_user    如果nginx有配置認證,該變數代表客戶端認證的使用者名稱

$request_body_file    做反向**時發給後端伺服器的本地資源的名稱

$request_method    請求方法,get/put/delete等

$request_filename    當前請求的資源檔案的路徑名稱,相當於是$document_root/$document_uri的組合

$request_uri    請求的鏈結,包括$document_uri和$args

$scheme    請求的協議,如ftp,http,https

$server_protocol    客戶端請求資源使用的協議的版本,如http/1.0,http/1.1,http/2.0等

$server_addr    伺服器ip位址

$server_name    伺服器的主機名

$server_port    伺服器的埠號

$uri    和$document_uri相同

$http_referer    客戶端請求時的referer,通俗講就是該請求是通過哪個鏈結跳過來的,用curl -e可以指定

Nginx 全域性變數

args 此變數與請求行中的引數相等 content length 等於請求行的 content length 的值。content type 等同與請求頭部的 content type 的值 document root 等同於當前請求的root指令指定的值 document uri 與 uri一樣...

nginx全域性變數

經常需要配置nginx 其中有許多以 開頭的變數,經常需要查閱nginx 所支援的變數。nginx支援的http變數實現在 ngx http variables.c 的 ngx http core variables儲存實現 把這些變數提取下,總結如下 1.0.8版 args 請求中的引數 bina...

nginx 全域性變數

名稱,說明 變數列表 於檔案 ngx http variables args,請求中的引數 binary remote addr,遠端位址的二進位制表示 body bytes sent,已傳送的訊息體位元組數 content length,http請求資訊裡的 content length cont...