

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
3 messages in ru.sysoev.nginxRe: how can i use memcached_module
![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: how can i use memcached_module | Actions... |
|---|---|---|
| From: | 焦胜强 (jiao...@public.gmane.org) | |
| Date: | May 6, 2007 9:35:06 pm | |
| List: | ru.sysoev.nginx | |
thank you very much,i understand,i will try it for web CDN
2007/5/7, Liang Jin <mywe...@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, 焦胜强 <jia...@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...@hotmail.com Email: jia...@mail.51.com Visit us: http://www.51.com







