Welcome! Log In Create A New Profile

Advanced

proxy_cache not working

June 23, 2011 06:23AM
Greetings

I'm trying to setup reverse proxy cache but the cache path is always empty and tcpdump tells me there is no caching. Here is my configuration (all non-mentioned files are default):

$ cat /etc/nginx/conf.d/cache.conf
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=disk-cache:8m max_size=1000m inactive=600m;
proxy_temp_path /tmp/nginx;

/etc/nginx/sites-enabled/default:
location ~ ^/userProfileConfig($|/.*) {

proxy_cache disk-cache;
proxy_cache_valid any 1m;

proxy_pass http://10.82.0.150:8888;
proxy_redirect off;
proxy_buffering on;

proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

access_log /var/log/nginx/access.test.log;
error_log /var/log/nginx/error.test.log info;

}

There are no errors.

Additional info:

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.2 LTS"

$ nginx -V
nginx version: nginx/0.7.65
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-mail --with-mail_ssl_module --with-ipv6 --add-module=/build/buildd/nginx-0.7.65/modules/nginx-upstream-fair

$ curl http://192.168.122.22/userProfileConfig/1/1
<?xml version='1.0' encoding='UTF-8'?>...............

$ cat /var/log/nginx/access.test.log
192.168.122.1 - - [23/Jun/2011:11:40:53 +0200] "GET /userProfileConfig/1/1 HTTP/1.1" 200 1123 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"
192.168.122.1 - - [23/Jun/2011:11:44:01 +0200] "GET /userProfileConfig/1/1 HTTP/1.1" 200 1123 "-" "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18"

$ sudo du -h /var/cache/nginx/
4.0K /var/cache/nginx/

$ ls -l /var/cache/ | grep nginx
drwx------ 2 www-data root 4096 2011-06-23 11:41 nginx

Any help will be greatly appreciated.

Thanks in advance.
David.
Subject Author Posted

proxy_cache not working

dekar411 June 23, 2011 06:23AM

Re: proxy_cache not working

Maxim Dounin June 23, 2011 08:28AM

Re: proxy_cache not working

dekar411 June 23, 2011 09:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready