Nginx Debian Cache
nginx.conf
proxy_cache_path /var/www/cache levels=2:2 keys_zone=generic:500m inactive=3650d max_size=10g min_free=1g loader_files=1000 loader_sleep=50ms loader_threshold=300ms use_temp_path=off;
log_format cachelog '$remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_user_agent" "$upstream_cache_status"';
map $request_uri $nocache {
~InRelease 1;
~Release 1;
~Packages 1;
}
server {
listen 80 reuseport;
access_log /var/www/access.log cachelog;
error_log /var/www/error.log;
slice 1m;
proxy_cache generic;
proxy_ignore_headers Expires Cache-Control;
proxy_cache_valid 200 206 3650d;
proxy_cache_valid 301 302 0;
proxy_set_header Range $slice_range;
proxy_cache_lock on;
proxy_cache_lock_age 2m;
proxy_cache_lock_timeout 1h;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_revalidate on;
proxy_cache_bypass $nocache;
proxy_no_cache $nocache;
proxy_max_temp_file_size 1024m;
proxy_cache_key $http_host$uri$slice_range;
proxy_next_upstream error timeout http_404;
add_header X-Cache-Status $upstream_cache_status;
proxy_redirect off;
proxy_ignore_client_abort on;
proxy_ssl_server_name on;
location /debian/ {
proxy_pass https://debian.ethz.ch/debian/;
proxy_set_header Host "debian.ethz.ch";
}
location /debsec/ {
proxy_pass https://debian.ethz.ch/debian-security/;
proxy_set_header Host "debian.ethz.ch";
}
location = /nginx_status {
stub_status;
}
root /var/www/static/;
autoindex on;
}
debian.sources
Types: deb
URIs: http://localhost/debian/
Suites: trixie
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: http://localhost/debian/
Suites: trixie-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: http://localhost/debsec/
Suites: trixie-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg