zoukankan      html  css  js  c++  java
  • nginx 日志log_format

    打开nginx.conf 可以看到log_format 的默认配置如下,今天我们来一起学习一下nginx log_format 的配置,以及一些变量的作用;

    log_format main '$remote_addr - $remote_user [$time_local] $scheme $http_host $server_port "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for" '
    '$request_time $upstream_response_time $time_iso8601 '
    '$ssl_protocol';

    log_format  main  '$remote_addr - $remote_user [$time_local] $scheme $http_host $server_port "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      '$request_time $upstream_response_time $time_iso8601 '
                      '$ssl_protocol';
    

    nginx.conf 配置里面 使用log_formate

    access_log  /home/wwwlogs/domain_access.log main;
    

    log_format 参数注释:

        $remote_addr  #客户端IP
        $remote_user  #远程客户端用户名
        $time_local  #访问的时间
        $http_host  #访问的服务端域名
        $request  #用户的http请求起始行信息
        $status  #http状态码,记录请求返回的状态码,例如:200、301、404等
        $body_bytes_sent  #服务器发送给客户端的响应body字节数
        $http_referer  #记录此次请求是从哪个连接访问过来的,可以根据该参数进行防盗链设置。
        $http_user_agent  #记录客户端访问信息,例如:浏览器、手机客户端等
        $http_x_forwarded_for  #当前端有代理服务器时,设置web节点记录客户端地址的配置,此参数生效的前提是代理服务器也要进行相关的x_forwarded_for设置
        $request_time  #nginx处理请求的时间
        $upstream_response_time  #php-cgi的响应时间
    

      

     原文:https://blog.csdn.net/xianhenyuan/article/details/91308813

  • 相关阅读:
    JavaScript和DOM
    CSS补充以及后台页面布局
    HTML标签和CSS基础
    基于SQLAlchemy实现的堡垒机
    PymySQL
    SQLAlchemy
    负数取模
    list
    算法(3)
    python初识(3)
  • 原文地址:https://www.cnblogs.com/sucretan2010/p/12460659.html
Copyright © 2011-2022 走看看