Nginx memcached setting

sastro nginx-forum at
Sun Nov 21 20:29:48 MSK 2010

My server running Nginx and php-fpm for wordpress. Today i installed
memcached but i dont know how to setting the memcached thing into conf
file. Here is my wordpres conf file
        listen 80;
        access_log /var/log/nginx/mywpt.access_log;
        error_log /var/log/nginx/mywpt.error_log;

		root /home/mywebsite/public_html;
        location / {
          root /home/mywebsite/public_html/;
          index index.html index.htm index.php;

          # this serves static files that exist without running other
rewrite tests
          if (-f $request_filename) {
              expires 30d;

          # this sends all non-existing file or directory requests to
          if (!-e $request_filename) {
              rewrite ^(.+)$ /index.php?q=$1 last;

        location ~ \.php$ {
            fastcgi_index   index.php;
            fastcgi_param   SCRIPT_FILENAME
            include         fastcgi_params;


where to put this code ?

server {
  location / {
    set $memcached_key $uri;
    memcached_pass     name:11211;
    default_type       text/html;
    error_page         404 @fallback;
  location @fallback {
    proxy_pass backend;

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

More information about the nginx mailing list