開發在問說他們為debug需要想要記錄post 的data,在 nginx 中很簡單
只要在 log format 及所要記錄的 location 加上記錄即可
modify nginx.conf
log_format postdata escape=json '$remote_addr - [$time_local] - "$request" - "$request_body"';
...
...
#處理 php的 handler
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
...
...
# Please disable if not in debug mode to avoid the logs size greater..
if ($request_method = POST) {
access_log /var/log/nginx/postdata.log postdata;
}
}
加上後再重讀設定檔即可
你必須 登入 才能發表評論。