nginx打印post请求参数

nginx.conf

/usr/local/webserver/tengine/conf/nginx.conf

1
2
3
4
5
http {
log_format post_tag '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body"';
}

service.**.com.conf

/usr/local/tengine-2.0.2/conf/vhosts.d/service.**.com.conf

1
2
3
4
5
6
7
8
9
location /newapi/ {
if ($content_type ~* "application/x-www-form-urlencoded") {
access_log /data/fund/logs/service.******.com_access.log post_tag;
}

rewrite ^/newapi/(.*)$ /$1 break;
proxy_pass http://newapi;

}

h5.**.com.conf

/usr/local/tengine-2.0.2/conf/vhosts.d/h5.**.com.conf

1
2
3
4
5
6
7
8
9
location /gxq/ {
if ($content_type ~* "application/x-www-form-urlencoded") {
access_log /data/fund/logs/h5.******.com_access.log post_tag;
}

rewrite ^/gxq/(.*)$ /$1 break;
proxy_pass http://newapi;

}

https://serverfault.com/questions/649151/nginx-location-regex-doesnt-work-with-proxy-pass/649196#649196

发布于

2023-04-28

更新于

2023-08-18

许可协议

评论