502 bad gateway, something about the header?
Igor Sysoev
is at rambler-co.ru
Sun Aug 30 12:50:53 MSD 2009
On Sun, Aug 30, 2009 at 03:51:06AM +0700, Joe wrote:
> Igor,
>
> May I also asking too?
> I am trying to do "getconf PAGESIZE" and the answer is "4096".
> I am also often have "502 Bad Gateway" page, and I change the settings to:
>
> fastcgi_connect_timeout 60;
> fastcgi_send_timeout 180;
> fastcgi_read_timeout 180;
> fastcgi_buffer_size 128k;
> fastcgi_buffers 4 256k;
> fastcgi_busy_buffers_size 256k;
> fastcgi_temp_file_write_size 256k;
> fastcgi_intercept_errors on;
>
> Are those settings to over and make the cpu and memory work harder?
>
> Thank You in advanced Igor.
It's better to decrease fastcgi_buffer_size to a value that you really need.
It may be 16K, 32K, or more. Also, it's better to create more
fastcgi_buffers of lesser size then small number of large fastcgi_buffers:
fastcgi_buffers 32 32k;
is better than
fastcgi_buffers 4 256k;
because if you response is 64K, then only two 32K buffers will be allocated
in the former case, and one 256K in the later case.
> Regards,
> Joe
>
>
> 2009/8/30 Igor Sysoev <is at rambler-co.ru>
>
> > On Sat, Aug 29, 2009 at 12:35:47PM -0700, Michael Shadle wrote:
> >
> > > fastcgi_buffers 32 8k;
> > >
> > > I have that already...
> >
> > Try
> >
> > fastcgi_buffer_size 16k;
> > fastcgi_buffers 16 16k;
> >
> > fastcgi_buffer_size is buffer where response header is read.
> > It may has different size as compared to fastcgi_buffers.
> >
> > > 2009/8/29 Igor Sysoev <is at rambler-co.ru>:
> > > > On Sat, Aug 29, 2009 at 11:10:43AM -0700, Michael Shadle wrote:
> > > >
> > > >> Does anyone see a problem here? The fastcgi parser returns back a -2,
> > > >> instead of 0 on a normal request. I don't see anything wrong with this
> > > >> header - the only thing that sticks out is the "//" - but still - I
> > > >> think this is a bug in nginx. Why does it say upstream split a header
> > > >> line? There are no \n \0 \r etc...
> > > >>
> > > >> Any help is appreciated - Igor, I sent you a larger chunk of the log
> > > >> privately unedited (I edited the hostnames to protect the innocent on
> > > >> this)
> > > >>
> > > >> Thanks!
> > > >>
> > > >> 2009/08/28 12:17:01 [debug] 20714#0: *7231991 http fastcgi header:
> > > >> "Set-Cookie:
> > IBBUSER=pT061zDsSOKTipBqqbbOAJG0RMGGkyUimUAbWHVjZPm4QKksTL16sTHCINiUH22GJoE6hnF3GDiBVFEf3nLovNeXec//EkQa7IclJOOCh2wdQ+PhexQNCg5PKFmU72VQriEyYIDUOQXgfwpWTfvzEeHJnNIGiAVRzNbKBSoQIyKjbgVIfhLV+LAFR3mltZBRS+qYH5AIpdSLtNtGtHVu0Fl9/OfvEBRz2zwsFUhVYW2zPIAG/OX/YVc+NV+M1va1pcWcuwkMgHK4FrYdbXjANymt9BsVo7y0+F3kxqcXmiKJioCSiCd+1fQJnLG0lUClD9qLGSDp9KBz4uzzpsmUYmEXvv2JDOTS+WEBL2+f+j/6wlRHFKYxOls9fZgAR2Lhotro+Rbfhu1iaPkubGKEIHI0FU+366pDWs1IKcy7rtJsHQovG+4Z1bDvx6CYC2yOTJ7VvBIRpFw3z2/v1tNcK9DwI/3lUQ4gdXtAXYtMmo42sO7doi18bKkeIGH8z1DtTrruBbZX4OLhSPts0non1d4yGHrY644PbZXbehW4HKpygqbX6sJobZf4eHzKh1nFkuHZUfZUFroE5yT17Bd/4g==;
> > > >> domain=.foo.com; expires=Sun, 27-Sep-2009 19:17:01 GMT; path=/"
> > > >> 2009/08/28 12:17:01 [debug] 20714#0: *7231991 http fastcgi parser: -2
> > > >> 2009/08/28 12:17:01 [debug] 20714#0: *7231991 upstream split a header
> > > >> line in FastCGI records
> > > >> 2009/08/28 12:17:01 [error] 20714#0: *7231991 upstream sent too big
> > > >> header while reading response header from upstream, client:
> > > >> 134.134.139.72, server: ssl.foo.com, request: "POST
> > > >> /en-us/login/?TARGET=http%3A%2F%2Ffoo.com%2Fpage%2F HTTP/1.1",
> > > >> upstream: "fastcgi://127.0.0.1:11021", host: "ssl.foo.com", referrer:
> > > >> "http://foo.com/en-us/login"
> > > >
> > > > What nginx version do use ? In 0.8.8 there are some bugfixes
> > > > in handling FastCGI headers split in records. However, in your case
> > > > it seems there is not enough fastcgi_buffer_size.
> > > >
> > > >
> > > > --
> > > > Igor Sysoev
> > > > http://sysoev.ru/en/
> > > >
> > > >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list