Welcome! Log In Create A New Profile

Advanced

Re: nginx support for http/1.1 backend

Ryan Malayter
October 19, 2010 09:08AM
On Tue, Oct 19, 2010 at 6:54 AM, Splitice <mat999@gmail.com> wrote:
> Seconded. Also the ability to cache gzip is a must

This can be done in nginx now by "layering" two nginx server blocks
together. The "front" one implements proxy_cache, while the back one
does compression and talks to the origin server. You get twice the
number of connections when you're actually talking to a back-end, but
if your cache hit ratio is high, that shouldn't matter and the
connections are very short-lived.

You should also "normalize" the incoming accept-encoding headers to
either "gzip" or "", and use that as part of the proxy cache key.

Something like this (untested syntax):

#frontend configuration which talks to client and caches
server {
listen 80
set $myacceptencoding "";
if ($http_accept_encoding *~ "gzip") {
set $myacceptencoding "gzip";
}
location / {
proxy_set_header "Accept-Encoding" $myacceptencoding;
proxy_cache my_cache_zone_name;
proxy_cache_key "$scheme$host$request_uri$myacceptencoding"
proxy_pass http://127.0.0.01:10080
}
}
#backend server block which talks to origin and compresses
server {
listen 10080
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_types text/css text/javascript text/xml application/x-javascript;
location / {
proxy_pass http://realbackend
}
}

--
RPM

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

nginx support for http/1.1 backend

Pasi Kärkkäinen October 18, 2010 08:54AM

Re: nginx support for http/1.1 backend

Pasi Kärkkäinen October 19, 2010 07:48AM

Re: nginx support for http/1.1 backend

Splitice October 19, 2010 07:58AM

Re: nginx support for http/1.1 backend

Ryan Malayter October 19, 2010 09:08AM

Fwd: nginx support for http/1.1 backend

SplitIce October 20, 2010 01:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 159
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