开发者

How to configure NGINX with Memcached to serve HTML

开发者 https://www.devze.com 2023-02-13 21:18 出处:网络
I\'m trying to configure NGINX with Memcached to serve HTML I found the following Memcached module for NGINX:

I'm trying to configure NGINX with Memcached to serve HTML

I found the following Memcached module for NGINX:

http://wiki.nginx.org/NginxHttpMemcachedModule

But I can't seem to get NGINX to serve my HTML (e.g. index.html) files from Memcached from reading the tutorial above.

Anyone know what the NGINX config should be to bet it 开发者_Go百科to serve HTML from Memcached?


To use memcached with nginx like this you will need to populate memcached with the right key/value pairs. To do this you will need the @fallback location to do some work for you.

When a matching request comes in, nginx will query memcached with whatever you set $memcache_key to. If the value is found it is sent to the browser. If not the fallback location invokes your backend system to do two things:

  1. generate a response and send it back to the browser.

  2. send the response to memcached and set the appropriate key/value pair.

The next time a request comes in for the same key it will be in memcached and will be served directly from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消