nginx內建屬性

2021-08-29 09:48:42 字數 2571 閱讀 4051

名稱        版本        說明(變數列表**於檔案 ngx_http_variables )

$args        1.0.8        請求中的引數;

$binary_remote_addr        1.0.8        遠端位址的二進位制表示

$body_bytes_sent        1.0.8        已傳送的訊息體位元組數

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

$content_type        1.0.8        請求資訊裡的"content-type";

$document_root        1.0.8        針對當前請求的根路徑設定值;

$document_uri        1.0.8        與$uri相同; 比如 /test1/test2/test.php

$host        1.0.8        請求資訊中的"host",如果請求中沒有host行,則等於設定的伺服器名;

$hostname        1.0.8       

$http_cookie        1.0.8        cookie 資訊

$http_referer        1.0.8        引用位址

$http_user_agent        1.0.8        客戶端**資訊

$http_via        1.0.8        最後乙個訪問伺服器的ip位址。

$http_x_forwarded_for        1.0.8        相當於網路訪問路徑。

$is_args        1.0.8       

$limit_rate        1.0.8        對連線速率的限制;

$nginx_version        1.0.8       

$pid        1.0.8       

$query_string        1.0.8        與$args相同;

$realpath_root        1.0.8       

$remote_addr        1.0.8        客戶端位址;

$remote_port        1.0.8        客戶端埠號;

$remote_user        1.0.8        客戶端使用者名稱,認證用;

$request        1.0.8        使用者請求

$request_body        1.0.8       

$request_body_file        1.0.8        發往後端的本地檔名稱

$request_completion        1.0.8       

$request_filename        1.0.8        當前請求的檔案路徑名,比如$request_filename:d:\nginx/html/test1/test2/test.php

$request_method        1.0.8        請求的方法,比如"get"、"post"等;

$request_uri        1.0.8        請求的uri,帶引數; 比如http://localhost:88/test1/test2/test.php

$scheme        1.0.8        所用的協議,比如http或者是https,比如rewrite^(.+)$$scheme:

$server_addr        1.0.8        伺服器位址,如果沒有用listen指明伺服器位址,使用這個變數將發起一次系統呼叫以取得位址(造成資源浪費);

$server_name        1.0.8        請求到達的伺服器名;

$server_port        1.0.8        請求到達的伺服器端口號;

$server_protocol        1.0.8        請求的協議版本,"http/1.0"或"http/1.1";

$uri        1.0.8        請求的uri,可能和最初的值有不同,比如經過重定向之類的。

nginx內建變數

nginx作為乙個成熟 久經考驗的負載均衡軟體,與其提供豐富 完整的內建變數是分不開的,它極大增加了對nginx網路行為的控制細度。這些變數大部分都是在請求進入時解析的,並把他們快取到請求cycle中,方便下一次獲取使用。首先來看看nginx對都開放了那些api。參看下表 名稱說明 arg name...

nginx 內建變數

在配置基於nginx伺服器的 時,必然會用到 nginx內建變數 下面筆者將它整理成列表,把最新版本的變數列出來,以方便做配置時查詢 nginx內建變數 內建變數存放在 ngx http core module 模組中,變數的命名方式和apache 伺服器變數是一致的。總而言之,這些變數代表著客戶端...

nginx內建變數

變數名 定義 arg parameter get請求中變數名parameter引數的值。args 這個變數等於get請求中的引數。例如,foo 123 bar blahblah 這個變數只可以被修改 binary remote addr 二進位製碼形式的客戶端位址。body bytes sent 傳...