nginx use memc

lys0212 nginx-forum at
Thu Sep 22 09:25:05 UTC 2011

     Encountered in the use of memc such a problem, I do not know how to
solve. In the nginx configuration file and php file using memc, can be
normal cache. However, if the cache of php file include jump statement,
such as @header, then jump failure. How to solve this problem?
server {
 location  ~ /async/(.*) {
                set_md5                 $md5               
                set $memc_key $md5;
                memc_pass memcbackend;
                memc_flags_to_last_modified on;
                memc_connect_timeout  30s;
                memc_send_timeout 30s;
                memc_read_timeout 30s;
                access_log   off;
                expires      max;
                error_page     404 = /async/index.php?$query_string ;
php file /async/index.php
  $url = "";
  @header ( "HTTP/1.1 301 Moved Permanently" );
  @header ( "Location: " . $url );
  $m = new Memcached();
  $m->addServer('', 3000);
  $m->setOption(Memcached::OPT_COMPRESSION, false);
  $time =  time();
  $urlInfo = parse_url($_SERVER ['REQUEST_URI']);
  echo $key;
  $m->set(md5($key), $time ,60);
If the access address
/async/ directory is not include test.phpd  file, it will be 404
redirected to /async/ index.php, but the @header  in /async/index.php 
will not be effective.
  How to solve this problem? Thank you very much!

Posted at Nginx Forum:,215565,215565#msg-215565

More information about the nginx mailing list