82 lines
1.7 KiB
Django/Jinja
82 lines
1.7 KiB
Django/Jinja
map $uri
|
|
$to_proxy_uri
|
|
{
|
|
volatile;
|
|
|
|
~^/[^/]+/(.*)$ $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 (j2cfg.my_caches or []) %}
|
|
proxy_cache_path
|
|
/angie/my-cache/{{ h.name }}
|
|
keys_zone={{ h.name }}:20m
|
|
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 (j2cfg.my_caches or []) %}
|
|
location /{{ h.name }}/ {
|
|
proxy_pass {{ h.uri }}/$to_proxy_uri$is_args$args;
|
|
|
|
proxy_cache {{ h.name }};
|
|
|
|
expires {{ h.valid_time }};
|
|
|
|
proxy_cache_valid 200 {{ h.valid_time }};
|
|
proxy_cache_valid any 30s;
|
|
}
|
|
{%- endfor %}
|
|
}
|