Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to increase nginx buffer

Tags:

nginx

I have the nginx server running fine with this config.

server {
    location / {
        proxy_pass http://127.0.0.1:8000;

    }

}

but when I try and modify buffer size it fails.

server {
    location / {
        client_body_buffer_size 10K;
        client_header_buffer_size 1k;
        client_max_body_size 8m;
        large_client_header_buffers 2 1k;
        proxy_pass http://127.0.0.1:8000;

    }


}

I get this error

Reloading nginx configuration: nginx: [emerg] "client_header_buffer_size" directive is not allowed here

Any suggestions?

like image 216
nadermx Avatar asked Jan 07 '23 19:01

nadermx


1 Answers

The client_header_buffer_size is not available within the "location" context. You'll also need to move the large_client_header_buffers Move them to within the "server" context and it'll work.

server {
    client_header_buffer_size 1k;
    large_client_header_buffers 2 1k;

    location / {
        client_body_buffer_size 10K;
        client_max_body_size 8m;            
        proxy_pass http://127.0.0.1:8000;
    }
}

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

like image 165
justcompile Avatar answered Jan 17 '23 19:01

justcompile