leeyjeen
leeyjeen

Reputation: 33

nginx: [emerg] "proxy_buffers" directive invalid value in /etc/nginx/sites-enabled/

I tried to restart nginx with command, but error occured.

When I run "sudo systemctl restart nginx", this happens.

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

When I run "systemctl status nginx.service", this happens.

Mar 30 08:55:04 ip-172-31-22-186 nginx[2624]: nginx: [emerg] "proxy_buffers" directive invalid value in /etc/nginx/sites-enabled/...:19 Mar 30 08:55:04 ip-172-31-22-186 nginx[2624]: nginx: configuration file /etc/nginx/nginx.conf test failed

in nginx.conf file:

   location / {
            ....
            proxy_buffer_size 0M;
            proxy_buffers 4 0M;
            proxy_busy_buffers_size 0M;
            client_max_body_size 0M;
    }

is there a problem with the configuration here?

Upvotes: 0

Views: 2040

Answers (1)

Timo Stark
Timo Stark

Reputation: 3071

The proxy_buffers can not be configured like this. Based on what they are used for how how they are designed you can NOT set a buffer of 0m. This would set a memory size (page size) of 0M.

proxy_buffers

Sets the number and size of the buffers used for reading a response from the proxied server, for a single connection. By default, the buffer size is equal to one memory page. This is either 4K or 8K, depending on a platform.

The proxy buffer size is equal to a memory page. To find your current memory_page size type:

getconf PAGE_SIZE

This should return 4096(bytes) -> 4K.

So as you can see there is a reason why you can only use 4K or 8K depending on your system architecture.

We have a great blog post about proxying in general.

https://www.nginx.com/blog/performance-tuning-tips-tricks/

By turning proxy_buffering to on you can configure the proxy_buffers with the directives shown in the docs:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering

Upvotes: 0

Related Questions