# Memcached error page not work fine

**URL:** <https://www.ruby-forum.com/t/memcached-error-page-not-work-fine/209982>\
**Category:** NGINX\
**Created:** [July 27, 2011, 4:12pm UTC](https://www.ruby-forum.com/t/memcached-error-page-not-work-fine/209982 "2011-07-27T16:12:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 27, 2011, 4:12pm UTC](https://www.ruby-forum.com/t/memcached-error-page-not-work-fine/209982/1 "2011-07-27T16:12:57Z")

</div>

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](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](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](http://localhost:8081);  
proxy\_pass [http://localhost:14100](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;  
memcached\_pass 10.20.141.149:60001;  
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;  
memcached\_pass 10.20.141.149:60001;  
default\_type text/html;  
error\_page 404 /c.html;  
}

---

<div class="post-metadata">

**Author:** ![m\_zy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b9bd4f/32.png) [@m\_zy](https://www.ruby-forum.com/u/m_zy)\
**Post date:** [July 27, 2011, 4:42pm UTC](https://www.ruby-forum.com/t/memcached-error-page-not-work-fine/209982/2 "2011-07-27T16:42:05Z")

</div>

Hello!

On Wed, Jul 27, 2011 at 09:30:15PM +0800, m zy wrote:

> ```
> buy if i visit http://localhost/memtest/somepathnotfound c.html
> 
> ```
> 
> response ok, why?  
> can everybody help me please ,thank all!

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.
