1
0

initial commit

This commit is contained in:
2025-06-05 11:01:19 +03:00
commit 48f13f97a3
297 changed files with 7136 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
my_caches:
- name: apt_debian
uri: https://deb.debian.org/debian
valid_time: 180m
max_time: 1440h
- name: apt_debian_security
uri: https://deb.debian.org/debian-security
valid_time: 180m
max_time: 1440h
- name: apt_ubuntu
uri: https://archive.ubuntu.com/ubuntu
valid_time: 180m
max_time: 1440h

View File

@@ -0,0 +1,79 @@
{%- import 'snip/cache.j2mod' as ngx_cache -%}
{%- set my_caches = (j2cfg.my_caches or []) -%}
map $uri
$to_proxy_uri
{
~^/[^/]+/(.*)$ $1;
}
map $request_method
$to_proxy_method
{
default GET;
## already handled by "proxy_cache_convert_head on;" (default setting)
# HEAD GET;
OPTIONS OPTIONS;
}
## quirks
chunked_transfer_encoding off;
proxy_method $to_proxy_method;
proxy_ignore_client_abort on;
proxy_ignore_headers Cache-Control Expires Set-Cookie Vary X-Accel-Buffering X-Accel-Expires X-Accel-Limit-Rate;
## tuning
proxy_cache_key $to_proxy_uri$is_args$args;
proxy_cache_lock on;
proxy_cache_lock_age 20s;
proxy_cache_lock_timeout 25s;
proxy_cache_use_stale error timeout invalid_header updating http_429 http_500 http_502 http_503 http_504;
proxy_cache_revalidate on;
{%- for h in my_caches %}
{{ ngx_cache.proxy_cache_path(h.name, size='10m', levels='1:2', inactive=h.max_time) }}
{%- endfor %}
server {
listen 8888;
location / { return 204; }
location /console/ {
# allow 127.0.0.0/8;
# deny all;
auto_redirect on;
alias /usr/share/angie-console-light/html/;
index index.html;
location /console/api/
{
access_log off;
api /status/;
}
location /console/api/config/
{
access_log off;
api /config/;
}
}
{%- for h in my_caches %}
location /{{ h.name }}/ {
proxy_pass {{ h.uri }}/;
proxy_cache {{ h.name }};
expires {{ h.valid_time }};
proxy_cache_valid 200 {{ h.valid_time }};
proxy_cache_valid any 30s;
}
{%- endfor %}
}