memcached problems...

InterNetX - Jürgen Gotteswinter juergen.gotteswinter at internetx.de
Mon Aug 31 23:07:35 MSD 2009


Hallo folks again,

i try to configure nginx to deliver swf files etc, and wanted to cache 
them within memcached. but until now i didnt have much success with that.
what i already did:

include/excluded parts of the config (flv part, swf part & php part) and 
tested them one by one. no change... but if i try to open a sfv file via 
browser i see that nginx communicates with memcached and this error 
messages appears in the nginx error log (without the memcached part in 
the config i get the file as download, like expected)

2009/08/31 18:34:40 [info] 23808#0: *1 key: 
"/files/_somewhere/xxx/xxxx.flv" was not found by memcached while 
reading response header from upstream, client: 62.
116.129.3, server: media, request: "GET /files/_somewhere/xxx/xxxx.flv 
HTTP/1.1", upstream: "memcached://127.0.0.1:11211", host: "ftp.xxx.org:8
1"

it seems that nginx looks in memcached for the file, but it has not yet 
read from the disk so nginx cant find it inside memcached and throws me 
a 404


heres my nginx.conf



http {
     include       /etc/nginx/mime.types;
     default_type  application/octet-stream;


     log_format  main  '$http_host $remote_addr - $remote_user 
[$time_local] $request '
                       '"$status" $body_bytes_sent "$http_referer" '
                       '"$http_user_agent" "$http_x_forwarded_for"';

     access_log  /var/log/nginx/access.log  main;

     sendfile        on;
     tcp_nopush     on;

     #keepalive_timeout  0;
     keepalive_timeout  65;

     #gzip  on;
     server {
         listen       81;
         server_name  media;

         #charset koi8-r;

         #access_log  logs/host.access.log  main;


         location / {
             root   /home/www/htdocs;
             index  index.html index.htm;


         error_page  404     http://failover.somewhere.de/404.html;

         location ~ \.flv$ {
             memcached_pass 127.0.0.1:11211;
             set $memcached_key $uri;
             root           /home/www/htdocs;
         }

         location ~ \.swf$ {
             set $memcached_key $uri;
             memcached_pass     127.0.0.1:11211;
             root           /home/www/htdocs;
         }

      location ~ /\.ht* {
             deny  all;
         }
      }
}






More information about the nginx mailing list