-1

Recently, the program encounter ed a problem, LNMP environment, because PHP in the program spliced GET request uri parameter is too long, resulting in an error, nginx processing uri is too long can be processed by client_head_buffer_size parameter, but when nginx received the uri request forward to PHP, fastcgi can not handle the request error (do not consider changing the request to post).

System:linux CentOS7 nginx:1.14.0 php:7.2.0

Apache solution:

Add a few parameters to the configuration file LimitRequestLine 40940 LimitRequestFieldSize 40940

Nginx solution:

**How to increase the limit of fastcgi to accept uri parameter size?**

user              test;
worker_processes  2;
worker_cpu_affinity 0101 1010;
worker_rlimit_nofile 65535;

events {
    use epoll;
    worker_connections  65535;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';
include              mime.types;
default_type application/octet-stream;
charset utf-8;
sendfile                     on;
tcp_nopush                   on;
keepalive_timeout          300s;
client_header_timeout      300s;
client_body_timeout        300s;
client_max_body_size       100m;
client_body_buffer_size   2048k;
client_header_buffer_size  1024k;
large_client_header_buffers 32 64k;
send_timeout               300s;
fastcgi_connect_timeout    300s;
fastcgi_send_timeout       300s;
fastcgi_read_timeout       300s;
fastcgi_buffer_size       1024k;
fastcgi_buffers          64 64k;
fastcgi_busy_buffers_size  2048k;
fastcgi_temp_file_write_size 2048k;
gzip                         on;
gzip_min_length              1k;
gzip_buffers             16 16k;
gzip_http_version           1.1;
gzip_types text/plain text/css application/javascript application/xml;
gzip_comp_level               3;
gzip_vary                    on;
server_names_hash_max_size  512;
server_names_hash_bucket_size  128;
include /*.conf;
}

Fastcgi error log [1]: https://i.stack.imgur.com/lzV4H.png

Please Help!!! SOS

0

Seems like this isn't fixable from only nginx or php-fpm side, but still fixable on the application level, - because upscaling the client_body_buffer isn't really a productive way (but as a workaround you could try, though I advise against it).

Please see this thread.

  • Thank you, but this does not solve my problem. Fastcgi still cannot receive request parameters greater than 64k.My god. – 丁文浩 Dec 14 '18 at 8:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.