Buffers, PHP-FastCGI and nginx

Igor Sysoev is at rambler-co.ru
Mon Jun 23 23:29:48 MSD 2008

On Mon, Jun 23, 2008 at 05:20:34PM +0100, Phillip B Oldham wrote:

> Am I correct in assuming I'll get the best performance from my nginx+php 
> setup if I:
> - set PHP's output_buffering to 4096
> - set PHP's zlib.output_compression to On

You should turn PHP's zlib.output_compression off.

> - set nginx's fastcgi_buffers to the same number of php instances, and 
> to a size of 4k

No, fastcgi_buffers is per connection. For example, if

fastcgi_pass   8  4k;

then each FastCGI connection may use up to 8 buffers.

You should set fastcgi_buffers to correspond to a typical response size.

> - set nginx's client_body_buffer_size to 4k

Probably, no. You should set it bigger, something about 64K or 128K to
avoid buffering to tempoarary file.

> - set nginx to gzip everything if the client accepts it


Igor Sysoev

More information about the nginx mailing list