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:
generate a response and send it back to the browser.
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.
精彩评论