Can't get Nginx to work with memcached

sayeo87 nginx-forum at nginx.us
Fri May 29 04:46:43 MSD 2009


Arrgghh......... so, I found out that some things are bugged within 0.6.32 so I installed 0.6.37 from source. After configuring everything, the same problem is occuring- ie: memcaching does not work. Here are my configs. Any help is much appreciated.

/usr/local/nginx/conf/nginx.conf


user  www-data;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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

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

    access_log  logs/access.log  main;

    sendfile        on;
    tcp_nopush     on;

    #keepalive_timeout  0;
    #keepalive_timeout  65;

    gzip  on;

	include /usr/local/nginx/conf/nginx.conf.default;

	upstream backend {
    	server 127.0.0.1:81;
	}

    server {

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
		listen 80;

        location / {
            root   html;
            index  index.html index.htm;
			set $memcached_key		$uri;	
			memcached_pass     127.0.0.1:11211;
			default_type	   text/html;
			error_page         404 = /fetch;
        }

		location /fetch {
			proxy_pass http://backend;
			break;
		}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

}





/usr/local/nginx/conf/nginx.conf.default

server {
    listen       80;
	server_name	localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
		set $memcached_key		$uri;
		memcached_pass     127.0.0.1:11211;
		default_type	   text/html;
		error_page         404 = /fetch;
    }

	location /fetch {
		proxy_pass http://backend;
		break;
	}

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}


Posted at Nginx Forum: http://forum.nginx.org/read.php?2,2438,2468#msg-2468






More information about the nginx mailing list