Welcome! Log In Create A New Profile


proxy_cache not working

June 23, 2011 06:23AM

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;

location ~ ^/userProfileConfig($|/.*) {

proxy_cache disk-cache;
proxy_cache_valid any 1m;

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

$ 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
<?xml version='1.0' encoding='UTF-8'?>...............

$ cat /var/log/nginx/access.test.log - - [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" - - [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/ 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.
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