jlthlx 发表于 2018-11-10 08:07:18

Nginx 一些内置的变量

core module var:  
$arg_PARAMETER
  
$args
  
$content_length
  
$content_type
  
$document_root
  
$document_uri
  
$host
  
$http_user_agent
  
$http_cookie
  
$is_args
  
$limit_rate
  
$query_string
  
$request_body_file
  
$request_method
  
$remote_addr
  
$remote_port
  
$remote_user
  
$request_filename
  
$request_uri
  
$scheme
  
$server_protocol
  
$server_addr
  
$server_name
  
$server_port
  
$uri
  
log module var:
  
$body_bytes_sent, the number of bytes, transmitted to client minus the response headers. This variable is compatible with the %B parameter of Apache's mod_log_config (this was called $apache_bytes_sent, before version 0.3.10)
  
$bytes_sent, the number of bytes transmitted to client
  
$connection, the number of connections
  
$msec, the current time at the moment of writing the log entry (microsecond accuracy)
  
$pipe, "p" if request was pipelined
  
$request_length, the length of the body of the request
  
$request_time, the time it took nginx to work on the request, in milliseconds, (in seconds for versions older than 0.5.19)
  
$status, status of answer
  
$time_local, local time into common log format.
  
$http_x_forwarded_for, X-Forward information
  
# 于 apache 兼容的日志格式
  
------------------------------------------------- APACHE2.2 ------------------------------------------------
  
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %D %{TETX_USER_KEY}C" combined
  
LogFormat "%h %l %u %t \"%r\" %>s %b" common
  
LogFormat "%{Referer}i -> %U" referer
  
LogFormat "%{User-agent}i" agent
  
================================================== Nginx 0.7.35 ============================================
  
log_formattetx'$remote_addr - $remote_user [$time_local] "$request" '
  
'$status $body_bytes_sent "$http_referer" '
  
'"$http_user_agent" 0 $request_time $TETX_USER_KEY "$http_x_forwarded_for" $host';
  



页: [1]
查看完整版本: Nginx 一些内置的变量