how can i use memcached_module
焦胜强
jiaosq at mail.51.com
Mon May 7 08:35:29 MSD 2007
thank you very much,i understand,i will try it for web CDN
2007/5/7, Liang Jin <mywebadmin at gmail.com>:
>
> Hi,
>
> First of all, you need to configure Memcached daemon. In the config
> file you showed, it is located at localhost:10000 .
>
> So when a client visit your site, nginx will try this Memcached server
> to fetch the key defined in $memcached_key. If the client requests
> domain1.com/path1/file1.php
>
> This URL would be the key in Memcached cache, that stores the HTML
> cache file for that page.
>
> If nginx cannot find the key in the Memcached cache, it will return an
> 404 error, which in the config file will fallback to the backend
> proxy.
>
> The first time when a visitor views the page, it will always fallback
> to the backend. At that time, you should add in your PHP code to store
> the HTML page in the Memcached with the correct key. So the next time,
> the page will be served by nginx using the contents in the Memcached
> cache.
>
> Does it make sense? For PHP memcached client, you can use the official
> php-memcache module.
>
> -Liang
>
>
>
> On 5/6/07, 焦胜强 <jiaosq at mail.51.com> wrote:
> > HI:
> > how can use the memcached_module in php?
> > can someone give a example?
> > I can not understand this configfile:
> > ...
> > upstream backend {
> > server localhost:80;
> > }
> > ...
> > location /memcached/ {
> > internal;
> > ssi on;
> > set $memuri $uri;
> > set $memcached_key "$memuri";
> > memcached_pass localhost:10000;
> > error_page 404 =200 /memcached-miss$memuri;
> > }
> > ...
> > location /memcached-miss/ {
> > internal;
> > ssi on;
> > rewrite ^/memcached-miss/(.*)$ /$1 break;
> > proxy_set_header Host $host;
> > proxy_set_header X-Real-IP $remote_addr;
> > proxy_pass http://backend;
> > proxy_redirect off;
> > }
> >
>
--
Best Regards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
焦胜强
上海我要网络发展有限公司 运维部
上海浦东新区峨山路91弄200号新鹏大厦2楼 邮编 200127
Tel: +86(021)58815151-5160
Fax: +86(021)50904695
QQ: 34849502
MSN: jsq_yy at hotmail.com
Email: jiaosq at mail.51.com
Visit us: http://www.51.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070507/2eaeed23/attachment.html>
More information about the nginx
mailing list