Welcome! Log In Create A New Profile

Advanced

Re: Help with Keepalive on NGINX

Maxim Dounin
July 26, 2013 06:04AM
Hello!

On Fri, Jul 26, 2013 at 10:33:42AM +0100, Nick Toseland wrote:

> Hi All,
>
> I am struggling to get keepalives to work on Nginx, I believe I have
> added the necessary configuration. Can you take a look and suggest
> where I may be going wrong or what I am missing?
>
> We have a nginx server that sits in front of a varnish server which
> sits in front of the back-end servers
>
> http {
>
> keepalive_timeout 120;
> keepalive_requests 500;
>
> upstream varnish_rand {
> server 172.21.1.1:80;
> keepalive 256;
> }
>
> server {
> server_name www.abc.com
>
> location / {
>
> proxy_pass http://varnish_rand;
> proxy_http_version 1.1;
>
> }
> }
>
> You can see that the nginx server is using HTTP1.1 to communicate
> with Varnish
>
> *varnishtop -i RxProtocol *
> list length 1
>
> 9.67 RxProtocol HTTP/1.1
>
> However there nginx always send a "connection close"
>
> *varnishtop -c -i RxHeader -I "Connection"*
>
> list length 1
>
> 9.59 RxHeader Connection: close

That's because nginx uses "Connection: close" by default,
regardless of a protocol version used. If you want keepalive to
work, you have to instruct nginx to don't send "Connection:
close" using the proxy_set_header directive.

For more information see documentation at
http://nginx.org/r/keepalive.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Help with Keepalive on NGINX

Nick Toseland July 26, 2013 05:34AM

Re: Help with Keepalive on NGINX

Maxim Dounin July 26, 2013 06:04AM

Re: Help with Keepalive on NGINX

Nick Toseland July 26, 2013 09:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready