HTTP GEO Module and Memcached Module question

Liang Jin mywebadmin at gmail.com
Tue May 1 01:15:18 MSD 2007


Thanks, Evan and Igor.

HTTP_X_GEO worked fine in PHP now. And for memcached, the default_type
text/html solved my problem. :)

I noticed that Igor mentioned that you will expand the support for
Memcached. I am curious about possible ideas on the improvement. I
would suggest that maybe adding memcached cluster support would be
great. For example, the requests can be distributed to several backend
servers with memcached and the load would be distributed among them
based on a certain request hash table. If one backend server went
down, nginx could go on and try another one instead, probably based on
a timeout value? Anyway, I am not that familiar with Memcached yet, so
I am hoping someone would come out with some better suggestions,
maybe. If this has been discussed before on the maillist, please bear
with a newcomer here.

Thanks.

-Liang


On 4/28/07, Igor Sysoev <is at rambler-co.ru> wrote:
> On Sat, Apr 28, 2007 at 09:46:21AM -0700, Liang Jin wrote:
>
> > Hi, I started experimenting the HTTP GEO Module and Memcached Module
> > from nginx, and have two questions:
> >
> > 1. HTTP GEO Module
> >
> > in the http configuration, i added something like this to detect the
> > IP address of the client and store the country code in the $geo
> > variable.
> >
> > geo  $geo  {
> >    default          US;
> >    127.0.0.1/32     US;
> >    10.1.0.0/16      UK;
> >     ......
> > }
> >
> > But the question is how I can transfer the variable to the backend
> > Apache server and let the PHP script know about the $geo variable. I
> > understand that for fastcgi you can get $geo as a parameter, just like
> > this:
> >
> > fastcgi_param GEO                     $geo;
> >
> > However, for reverse_proxy to Apache, how can I pass the $geo variable
> > on to the Apache server and eventually the PHP script?
>
> proxy_set_header  X-Geo  $geo;
>
> It will available in Apache as HTTP_X_GEO.
>
> > 2. Memcached Module
> >
> > Using 0.5.9 version, I have succeeded in making the memcache module
> > query and fetch the key value stored in Memcached.
> >
> > For example, if I set the key value in memcached in text format as
> > "whatever", nginx can query and get the value and feed it back to the
> > client browser. However, the question is: even if the text is valid
> > HTML, the browser still thinks it is data, not web pages, so it offers
> > me to download. I guess I need to set extra headers before the HTML in
> > order to make it work, but I cannot find any information on this.
>
> Currently, as it was suggested you can use default_type directive only:
>
>        location   ~*  \.html$ {
>            memcached   ...
>            default_type   text/html;
>        }
>
> I have plan to get headers from memcached if memcached response
> has set some flag.
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>





More information about the nginx mailing list