Welcome! Log In Create A New Profile

Advanced

caching issues with nginx as reverse-proxy

Anonymous User
June 29, 2016 06:04PM
Hi community,

currently I am serving files with a size about 1,5G (static without
dynamic content) using a hand full of nodes and nginx in reverse proxy
setup.
Caching works, ..but not as expected. During the requests nginx creates
a lot of temp caching files that grow up to the size of the origin file
delivered from backend server. It's kinda weird that even if the
inactive caching time out is not reached, the file is randomly
downloaded again from backend.

I guess that I just simply got blind by the configure that affects that.

## /etc/nginx/nginx.conf ##
proxy_cache_path /var/tmp/nginx-cache/rproxy levels=1:2
keys_zone=rproxy:260m max_size=5g inactive=260m use_temp_path=off;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
proxy_cache_valid 200 302 45m;
proxy_cache_valid 404 1m;

## /etc/nginx/sites-available/domain.tld ##
server {
listen 80;# default_server;
listen [::]:80;# default_server;

server_name domain.tld;

location / {
return 301 https://$host$request_uri;
}

}

server {

listen 443 ssl http2; #default_server;
listen [::]:443 ssl http2; #default_server;

ssl on;
ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem;

server_name domain.tld;

location / {
# proxy_buffering on;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_cache rproxy;
proxy_cache_use_stale error timeout http_500 http_502 http_503
http_504;
proxy_pass https://rproxy;
}

}
####

Nginx 1.11.1 is used. And the frontends got only 1gb ram and 10 gb of
disk space.

I am looking forward for any advice that could bring me some steps
forward to the right configuration :-)

Thanks in advance!

Best regards,
Daniel



_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

caching issues with nginx as reverse-proxy

Anonymous User June 29, 2016 06:04PM

Re: caching issues with nginx as reverse-proxy

Francis Daly June 30, 2016 03:16AM

Re: caching issues with nginx as reverse-proxy

Maxim Dounin June 30, 2016 08:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
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