nginx 记录 post的数据

在nginx的log_format设置中增加request_body

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

由于我们的项目是使用的proxy_pass,所以直接开启这个即可,如果不是这种方式,还需要lua脚本的支持才可以。

你可能感兴趣的:(nginx 记录 post的数据)