Nginx变量
HTTP请求变量
arg_PARAMETER、http_HEADER、sent_http_HEADER
HEADER替换指定header,横杠换下划线 比如 user-agent 就是 http_user_agent
内置变量
Nginx内置
http://nginx.org/en/docs/syslog.html
自定义变量
自己定义
日志配置
error.log
user nginx;
worker_processes 1;
# 日志存放路径
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
access.log
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'"$upstream_cache_status"';
# access_log路径,表示以main格式记录在access_log里
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}