Nginx 变量示例

Nginx变量配置示例

server {
listen 9090;
server_name localhost;
default_type text/plain;
location / {
set $limit_rate 10k;
return 200 'arg_a:$arg_a,arg_b:$arg_b,args:$args,is_args:$is_args
connection:$connection,connection_requests:$connection_requests
cookie_a:$cookie_a
uri:$uri,document_uri:$document_uri,request_uri:$request_uri
request:$request,request_id:$request_id
server:$server_addr,$server_name,$server_port,$server_protocol
scheme:$scheme
tcpinfo:$tcpinfo_rtt,$tcpinfo_rttvar,$tcpinfo_snd_cwnd,$tcpinfo_rcv_space
host:$host,server_name:$server_name,http_host:$http_host
limit_rate:$limit_rate
hostname:$hostname
content_length:$content_length
status:$status
body_bytes_sent:$body_bytes_sent,bytes_sent:$bytes_sent
time:$request_time,msec:$msec,time_iso8601:$time_iso8601,time_local:$time_local
remote_addr:$remote_addr,remote_port:$remote_port
http_user_agent:$http_user_agent
';
}
}

访问http://localhost:9090/?a=1&b=11 ,返回变量内容。

上一篇:
下一篇:

添加评论

电子邮件地址不会被公开。 必填项已用*标注