您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页nginx 日志(7)

nginx 日志(7)

来源:化拓教育网

nginx日志类型有两种,第一种是error.log日志,第二种是access_log日志。error.log是记录错误,access_log用来指定日志文件的存放路径、格式(把定义的log_format 跟在后面)和缓存大小;如果不想启用日志则access_log off ;

1.log_format配置语法

作用:用来设置日志格式

语法:

syntax: log_format name [escape=default | json] string ...;
default: log_format combined "...";
context: http

2.nginx变量

1.http请求变量

log_format  main  '$http_user_agent $remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

 access_log  /var/log/nginx/access.log  main;

2.内置变量

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务