|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果你只是想应付一下操作系统的课程,劝你最好别学,或者说不要指望能用的怎么样。
Variables
Thecoremodulesupportsbuilt-invariables,whosenamescorrespondwiththenamesofvariablesinApache.
Firstofall,therearethevariables,whichrepresentthelinesofthetitleoftheclientrequest,forexample,$http_user_agent,$http_cookie,andsoforth.
Furthermore,thereareothervariables:
Editsection:$arg_PARAMETER$arg_PARAMETER
ThisvariablecontainsthevalueoftheGETrequestvariablePARAMETERifpresentinthequerystring
Editsection:$args$args
Thisvariableisequaltoargumentsinthelineofrequest;
Editsection:$binary_remote_addr$binary_remote_addr
Theaddressoftheclientinbinaryform;
Editsection:$body_bytes_sent$body_bytes_sent
(undocumented)
Editsection:$content_length$content_length
ThisvariableisequaltolineContent-Lengthintheheaderofrequest;
Editsection:$content_type$content_type
ThisvariableisequaltolineContent-Typeintheheaderofrequest;
Editsection:$cookie_COOKIE$cookie_COOKIE
ThevalueofthecookieCOOKIE;
Editsection:$document_root$document_root
Thisvariableisequaltothevalueofdirectiverootforthecurrentrequest;
Editsection:$document_uri$document_uri
Thesameas$uri.
Editsection:$host$host
ThisvariableisequaltolineHostintheheaderofrequestornameoftheserverprocessingtherequestiftheHostheaderisnotavailable.
Thisvariablemayhaveadifferentvaluefrom$http_hostwhentheHostinputheaderisabsentorhasanemptyvalue.
Editsection:$http_HEADER$http_HEADER
ThevalueoftheHTTPheaderHEADERwhenconvertedtolowercaseandwith‘dashesconvertedto‘underscores,e.g.$http_user_agent,$http_referer…;
Editsection:$is_args$is_args
Evaluatesto“?”if$argsisset,“”otherwise.
Editsection:$limit_rate$limit_rate
Thisvariableallowslimitingtheconnectionrate.
Editsection:$query_string$query_string
Thesameas$args.
Editsection:$remote_addr$remote_addr
Theaddressoftheclient.
Editsection:$remote_port$remote_port
Theportoftheclient;
Editsection:$remote_user$remote_user
Thisvariableisequaltothenameofuser,authenticatedbytheAuthBasicModule;
Editsection:$request_filename$request_filename
Thisvariableisequaltopathtothefileforthecurrentrequest,formedfromdirectivesrootoraliasandURIrequest;
Editsection:$request_body$request_body
Thisvariable(0.7.58+)containsthebodyoftherequest.Thesignificanceofthisvariableappearsinlocationswithdirectivesproxy_passorfastcgi_pass.
Editsection:$request_body_file$request_body_file
Clientrequestbodytemporaryfilename;
Editsection:$request_completion$request_completion
(undocumented)
Editsection:$request_method$request_method
Thisvariableisequaltothemethodofrequest,usuallyGETorPOST.
Beforeandincluding0.8.20,thisvariablealwaysevaluatestothemethodnameofthemainrequest,notthecurrentrequestifthecurrentrequestisasubrequest.
Editsection:$request_uri$request_uri
ThisvariableisequaltothecompleteinitialURItogetherwiththearguments;
Editsection:$scheme$scheme
TheHTTPscheme(i.e.http,https).Evaluatedonlyondemand,forexample:
rewrite^(.+)$$scheme://example.com$1redirect;
Editsection:$server_addr$server_addr
Equaltotheserveraddress.Asarule,forobtainingthevalueofthisvariableisdoneonesystemcall.Inordertoavoidsystemcall,itisnecessarytoindicateaddressesindirectiveslistenandtouseparameterbind.
Editsection:$server_name$server_name
Thenameoftheserver.
Editsection:$server_port$server_port
Thisvariableisequaltotheportoftheserver,towhichtherequestarrived;
Editsection:$server_protocol$server_protocol
Thisvariableisequaltotheprotocolofrequest,usuallythisHTTP/1.0orHTTP/1.1.
Editsection:$uri$uri
ThisvariableisequaltocurrentURIintherequest,itcandifferfrominitial,forexamplebyinternalredirects,orwiththeuseofindexitisfilewithinternalredirects.
参考:
http://www.givingtree.com.cn/entry/Nginx-Location%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95
http://wiki.nginx.org/NginxHttpCoreModule#Variables
<P>
$args此变量与哀求行中的参数相称
$content_length即是哀求行的“Content_Length”的值。
$content_type同等与哀求头部的”Content_Type”的值
$document_root同等于以后哀求的root指令指定的值
$document_uri与$uri一样
$host与哀求头部中“Host”行指定的值或是request抵达的server的名字(没有Host行)一样
$limit_rate同意限定的毗连速度
$request_method同等于request的method,一般是“GET”或“POST”
$remote_addr客户端ip
$remote_port客户端port
$remote_user同等于用户名,由ngx_http_auth_basic_module认证
$request_filename以后哀求的文件的路径名,由root或alias和URIrequest组合而成
$request_body_file
$request_uri含有参数的完全的初始URI
$query_string与$args一样
$server_protocol同等于request的协定,利用“HTTP/1.0”或“HTTP/1.1”
$server_addrrequest抵达的server的ip,一样平常取得此变量的值的目标是举行体系挪用。为了不体系挪用,有需要在listen指令中指明ip,并利用bind参数。
$server_name哀求抵达的服务器名
$server_port哀求抵达的服务器的端标语
$uri同等于以后request中的URI,可分歧于初始值,比方外部重定向时或利用index
常常有些朋友在Linux论坛问一些问题,不过,其中大多数的问题都是很基的。 |
|