nginx memcached

nginx memcached,nginx,memcached,Nginx,Memcached,我尝试将nginx与memcached一起使用,配置如下: server { ... location / { default_type text/html; set $memcached_key $uri; memcached_pass 127.0.0.1:11211; error_page 404 = @fallback; } location @fallback {

我尝试将nginx与memcached一起使用,配置如下:

server {

    ...

    location / {
    default_type            text/html;
    set $memcached_key      $uri;
        memcached_pass 127.0.0.1:11211;
        error_page     404 = @fallback;
    }

    location @fallback {
        include uwsgi_params;
        uwsgi_pass unix:///var/tmp/site.sock;
    }

}
但所有请求都会转到uwsgi,而不使用memcache:

nginx-V

nginx-V nginx版本:nginx/1.1.19启用TLS SNI支持配置 参数:--prefix=/etc/nginx--conf path=/etc/nginx/nginx.conf --错误日志路径=/var/log/nginx/error.log--http客户端主体临时路径=/var/lib/nginx/body--http快速CGI临时路径=/var/lib/nginx/fastcgi--http日志路径=/var/log/nginx/access.log--http代理临时路径=/var/lib/nginx/proxy--http-scgi临时路径=/var/lib/nginx/scgi http-uwsgi临时路径=/var/lib/nginx/uwsgi-lock路径=/var/nginx/nginx-lock--pid path=/var/run/nginx.pid——带调试——带-http_添加_模块——带-http_dav_模块——带-http_geoip_模块——带-http_gzip_静态_模块——带-http_图像_过滤器_模块——带-http_realip_模块——带-http_存根_状态_模块——带-http_ssl_模块——带-http_子模块——带-http_xslt_模块——带-ipv6--with-sha1=/usr/include/openssl--with-md5=/usr/include/openssl--with-mail\U ssl\U module--add module=/build/buildd/nginx-1.1.19/debian/modules/nginx-auth-pam--add module=/build/buildd/nginx-1.19/debian/modules/nginx-up-fair --添加模块=/build/buildd/nginx-1.1.19/debian/modules/nginx-dav-ext-module

输出中没有ngx_http_memcached_模块

我使用Ubuntu 12.04和nginx,安装时附带
apt get install nginx

这是否意味着我必须安装它才能使用memcached或其他东西?

来自

换句话说,nginx只能检索已经存储在memcache中的东西


意味着nginx外部的
很可能是您的uwsgi应用程序

Thanx,它澄清了。。但是,nginx是否可以在不在后端执行的情况下填充memcached,nginx接收结果,那么为什么它不能将其保存在memcached中?不确定为什么会这样,因为迄今为止没有人费心实现它,我猜有一个第三方模块支持set,请参见(注意,第三方模块意味着您必须自己编译nginx)@在Ubuntu 12.04上安装nginx时,我从apt get获得了ngx_http_memcached_模块,但在14.04上没有。编辑:在这两种安装中,
configure arguments
中都没有列出它。奇怪的
The ngx_http_memcached_module module allows to obtain responses from a memcached 
server. The key is set in the $memcached_key variable. A response should be put 
in memcached in advance via means that are external to nginx.