nginx內建變數

來源:互聯網
上載者:User

nginx內建變數列表,根據 Nginx 源碼檔案 ngx_http_variables.c 提取了nginx 的內建變數。
根據不同的版本,變數可能有些變化,大多數還是可以用滴。




名稱 版本 說明(變數列表來源於檔案 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相同;
$host 1.0.8 請求資訊中的"Host",如果請求中沒有Host行,則等於設定的伺服器名;
$hostname 1.0.8  
$http_cookie 1.0.8 cookie 資訊
$http_post 1.0.8  
$http_referer 1.0.8 引用地址
$http_user_agent 1.0.8 用戶端代理資訊
$http_via 1.0.8 最後一個訪問伺服器的Ip地址。http://www.cnblogs.com/deng02/archive/2009/02/11/1387911.html
$http_x_forwarded_for 1.0.8 相當於網路訪問路徑。http://www.cnblogs.com/craig/archive/2008/11/18/1335809.html
$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_method 1.0.8 請求的方法,比如"GET"、"POST"等;
$request_uri 1.0.8 請求的URI,帶參數;
$scheme 1.0.8 所用的協議,比如http或者是https,比如rewrite^(.+)$$scheme://example.com$1redirect;
$sent_http_cache_control 1.0.8  
$sent_http_connection 1.0.8  
$sent_http_content_length 1.0.8  
$sent_http_content_type 1.0.8  
$sent_http_keep_alive 1.0.8  
$sent_http_last_modified 1.0.8  
$sent_http_location 1.0.8  
$sent_http_transfer_encoding 1.0.8  
$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,可能和最初的值有不同,比如經過重新導向之類的

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.