首页 > 其他 > 详细

nginx记录post数据日志

时间:2016-03-22 12:15:47      阅读:143      评论:0      收藏:0      [点我收藏+]

 1、vi nginx.conf

找到http {}中log_foramt ,定义post 日志格式

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

    log_format post_log ‘$remote_addr - $remote_user [$time_local] -- $request_body‘;

有日志demo形式,可根据自己需要配置日志格式。

2、在location php 解析{}中加入记录日志

access_log /opt/log/post.log post_log;

保存。重启即可

nginx记录post数据日志

原文:http://www.cnblogs.com/already/p/5305530.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!