.
3ss.cn

nginx拜访日志在哪里

nginx的log日志分为access log 和 error log

其中access log(访问日志)记录了哪些用户,哪些页面以及用户浏览器、ip和其他的访问信息

access日志格式配置

 log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"'
                       '$upstream_addr $upstream_response_time $request_time ';
    access_log  logs/access.log  main;

配置access log日志的存储位置及文件。

注意:access.log文件是可以按日期进行分割的,方便查看及处理

access_log /usr/local/nginx/log/access.log main;
$remote_addr 与$http_x_forwarded_for 用以记录客户端的ip地址;
$remote_user :用来记录客户端用户名称;
$time_local : 用来记录访问时间与时区;
$request : 用来记录请求的url与http协议;
$status : 用来记录请求状态;成功是200,
$body_bytes_s ent :记录发送给客户端文件主体内容大小;
$http_referer :用来记录从那个页面链接访问过来的;
$http_user_agent :记录客户端浏览器的相关信息;
赞(0)
未经允许不得转载:互联学术 » nginx拜访日志在哪里

评论 抢沙发