How to use srcache_store while proxy_pass use to connect backend

n1xman nginx-forum at nginx.us
Thu Mar 8 05:51:08 UTC 2012


Hi agentzh,

Thanks for helping me out. I build a fresh setup and enabled the debug
and followings are the details.

nginx.debug  -V
nginx: nginx version: nginx/1.0.9
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
nginx: TLS SNI support disabled
nginx: configure arguments: --prefix=/etc/nginx/
--sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx
--group=nginx --with-http_ssl_module --with-http_realip_module
--with-http_addition_module --with-http_sub_module
--with-http_dav_module --with-http_flv_module --with-http_mp4_module
--with-http_gzip_static_module --with-http_random_index_module
--with-http_secure_link_module --with-http_stub_status_module
--with-mail --with-mail_ssl_module --with-file-aio --with-ipv6
--with-debug --with-cc-opt='-O2 -g -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables'
--add-module=/usr/local/n1xman/rpmbuild/BUILD/nginx-1.0.9/contrib/memc-nginx-module-4007350
--add-module=/usr/local/n1xman/rpmbuild/BUILD/nginx-1.0.9/contrib/echo-nginx-module-6c1f553
--add-module=/usr/local/n1xman/rpmbuild/BUILD/nginx-1.0.9/contrib/simpl-ngx_devel_kit-24202b4
--add-module=/usr/local/n1xman/rpmbuild/BUILD/nginx-1.0.9/contrib/set-misc-nginx-module-e6a54ab
--add-module=/usr/local/n1xman/rpmbuild/BUILD/nginx-1.0.9/contrib/srcache-nginx-module-86e7a18


uname  -a
Linux abmx-test 2.6.18-194.el5PAE #1 SMP Tue Mar 16 22:00:21 EDT 2010
i686 i686 i386 GNU/Linux

cat /etc/nginx/nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

cat /etc/nginx/conf.d/default.conf
upstream my_mem {
        server 127.0.0.1:11211;
        }

server {
    listen       80;
    server_name  localhost;

    access_log /var/log/nginx/access.log main;
    error_log /var/log/nginx/error.log debug;

        default_type application/json;

location = /memc {
        internal;

        memc_connect_timeout 100ms;
        memc_send_timeout 100ms;
        memc_read_timeout 100ms;

        set $memc_key $query_string;
        set $memc_exptime 300;

        memc_pass my_mem;
    }

    location /mix2 {
        proxy_pass http://data.directfn.com;
        set $key $args;
        srcache_fetch GET /memc $key;
        srcache_store PUT /memc $key;
        srcache_store_statuses 200 301 302 404;

        }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}


/var/log/nginx/error.log
http://pastebin.com/W7Jk3sq8

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



More information about the nginx mailing list