nginx收到空包问题

tcpdump有收包,但是nginx的access.log显示post数据为空

可以通过tcpdump监控端口

http://www.cnblogs.com/linn/p/4792468.html

修改配置

client_header_buffer_size 20k;
    large_client_header_buffers 4 8k;
    client_max_body_size 8m;
client_body_in_single_buffer on;

client_header_buffer_size  large_client_header_buffers

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size

  1. 如果你的请求中的header都很大,那么应该使用client_header_buffer_size,这样能减少一次内存分配。
  2. 如果你的请求中只有少量请求header很大,那么应该使用large_client_header_buffers,因为这样就仅需在处理大header时才会分配更多的空间,从而减少无谓的内存空间浪费。

完整nginx.conf配置范例

http {
    include       mime.types;
    default_type  application/json;

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

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 40k;
    large_client_header_buffers 5 8k;
    client_max_body_size 8m;
    client_body_in_single_buffer on;
    tcp_nopush on;
    keepalive_timeout  15;
         keepalive_requests 8192;
    lua_max_pending_timers 1024;
    lua_max_running_timers 256;
    lua_need_request_body on;
    client_header_timeout  5;
    client_body_timeout    5;
    send_timeout          5;
    #lua_code_cache off;

  

原文地址:https://www.cnblogs.com/linn/p/4793841.html