1. 程式人生 > >nginx日誌定制

nginx日誌定制

length ima form 訪問 link erer date request 日誌

    1. 進入nginx安裝目錄
      cd /usr/local/nginx/

    2. vi nginx.conf

      log_format lvan ‘$remote_addr - $remote_user [$time_iso8601] "$request" $http_host ‘
      ‘$status $body_bytes_sent "$http_referer" ‘
      ‘"$http_user_agent" $http_x_forwarded_for ‘
      ‘"$upstream_addr" $upstream_status "$upstream_cache_status" "$upstream_http_content_type" $upstream_response_time "$request_time" $request_length $bytes_sent $server_name‘;

      技術分享
    3. 檢查nginx狀態
      /usr/local/nginx/sbin/nginx -t

      技術分享

    4. 重新加載nginx
      /usr/local/nginx/sbin/nginx -s reload

    5. 查看新的訪問日誌

      tail -100f /var/log/nginx/mqpublish.iapi.ymatou.com.log

nginx日誌定制