【问题标题】:How to configure NGINX with Memcached to serve HTML如何使用 Memcached 配置 NGINX 以提供 HTML
【发布时间】:2011-03-01 05:53:00
【问题描述】:

我正在尝试使用 Memcached 配置 NGINX 以提供 HTML

我为 NGINX 找到了以下 Memcached 模块:

http://wiki.nginx.org/NginxHttpMemcachedModule

但是通过阅读上面的教程,我似乎无法让 NGINX 从 Memcached 提供我的 HTML(例如 index.html)文件。

任何人都知道 NGINX 配置应该是什么来打赌它从 Memcached 提供 HTML 服务?

【问题讨论】:

    标签: performance memcached nginx


    【解决方案1】:

    要像这样将 memcached 与 nginx 一起使用,您需要使用正确的键/值对填充 memcached。为此,您需要@fallback 位置为您做一些工作。

    当匹配的请求进来时,nginx 会使用你设置的 $memcache_key 来查询 memcached。如果找到该值,则将其发送到浏览器。如果不是,则回退位置会调用您的后端系统来做两件事:

    1. 生成响应并将其发送回浏览器。

    2. 将响应发送到 memcached 并设置适当的键/值对。

    下次有相同键的请求进入时,它会在 memcached 中并直接从那里提供服务。

    【讨论】:

    • 伙计,我完全想知道为什么我的 nginx+memcached 似乎卡住了......我只是在我的 nginx conf 文件中错过了@fallback 规则! +1
    猜你喜欢
    • 2021-05-08
    • 2020-10-11
    • 1970-01-01
    • 2016-01-10
    • 2010-12-08
    • 2019-02-18
    • 1970-01-01
    • 1970-01-01
    • 2018-12-08
    相关资源
    最近更新 更多