memcached error page not work fine

m zy amhaker at
Wed Jul 27 13:30:15 UTC 2011

hi, all:
        i use nignx and tomat on my web site, tomcat work on 14100 port, i
want when tomcat error i can get the html from my memcache for response,
        if html not found in memcache should response c.html to client! but
i set "error_page 404 /c.html;" in  @mem don't work for me!
        this is my url: http://localhost/pos/2.htm(2 is key for memcache, 2
not found)
        the response to client is nginx default 404 page with text:
       404 Not Found
        not my config  c.html (command: error_page 404 /c.html;)
        buy if i visit http://localhost/memtest/somepathnotfound c.html
response ok, why?
        can everybody help me please ,thank all!

my nginx.conf:

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;
charset gbk;

        #access_log  logs/host.access.log  main;
        log_format  memc  'status=$status ip="$remote_addr"
time="$time_local" req="$request" args="$args" args2="$arg_PARAMETER"';

error_page  404 /c.html;
        location / {
            root   html;
            index  index.html index.htm;

location ^~ /pos/ {
    rewrite  ^/pos/(.*)\.(jsp|htm).*$ /index.jsp?$1 last;

   location ~* \.(htm|jsp)$ {
            #proxy_pass http://localhost:8081;
            proxy_pass http://localhost:14100;
      proxy_intercept_errors on;
    error_page 500 502 503 504 @mem;

location @mem {
    access_log logs/mem.log memc;
    set $memcached_key $args;
    proxy_intercept_errors on;
    default_type       text/html;
    error_page 404 /c.html;

location /memtest/ {
    access_log logs/mem.log memc;
    set $memcached_key $args;
    default_type       text/html;
    error_page 404 /c.html;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list