diff options
author | Erich Eckner <git@eckner.net> | 2020-09-24 14:30:27 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-09-24 14:30:27 +0200 |
commit | b9c5b185eea192a0f5f832d8112915d188442f2b (patch) | |
tree | f4d1a3ad2886522bd9482d707e9c448a34a6ecea /arch-mirror.home.eckner.net.conf | |
parent | 5713cf126cd3754e89269d8889cec6f842916ef3 (diff) | |
download | arch-mirror-b9c5b185eea192a0f5f832d8112915d188442f2b.tar.xz |
add cache server
Diffstat (limited to 'arch-mirror.home.eckner.net.conf')
-rw-r--r-- | arch-mirror.home.eckner.net.conf | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/arch-mirror.home.eckner.net.conf b/arch-mirror.home.eckner.net.conf index 3c9d627..5bdf0d5 100644 --- a/arch-mirror.home.eckner.net.conf +++ b/arch-mirror.home.eckner.net.conf @@ -39,23 +39,39 @@ server { # Requests for actual packages should be served directly from cache if available. # If not available, retrieve and save the package from an upstream mirror. location ~ /archlinuxewe/os/[^/]+/[^/]+\.tar\.(xz|zst)$ { - try_files $uri @pkg_mirrorewe; + try_files $uri @caches @pkg_mirrorewe; } location ~ ^/([^/]+)/archlinuxewe/([^/]+\.tar\.(xz|zst))$ { - try_files /archlinuxewe/os/$1/$2 @pkg_mirrorewe_reordered; + try_files /archlinuxewe/os/$1/$2 @caches_reordered @pkg_mirrorewe_reordered; } location ~ ^/(releng)/os/([^/]+)/([^/]+\.tar\.(xz|zst))$ { - try_files $uri @pkg_mirror32_reordered; + try_files $uri @caches @pkg_mirror32_reordered; } location ~ /x86_64/[^/]+\.tar\.(xz|zst)$ { - try_files $uri @pkg_mirror; + try_files $uri @caches @pkg_mirror; } location ~ /(i[46]86|pentium4)/[^/]+/[^/]+\.tar\.(xz|zst)$ { - try_files $uri @pkg_mirror32; + try_files $uri @caches @pkg_mirror32; } location ~ /(arm(v[67]h)?|aarch64)/[^/]+/[^/]+\.tar\.(xz|zst)$ { - try_files $uri @pkg_mirrorarm; + try_files $uri @caches @pkg_mirrorarm; + } + + # Retrieve package from cache of another local mirror + location @caches { + proxy_store on; + proxy_redirect off; + proxy_store_access user:rw group:rw all:r; + proxy_next_upstream error timeout http_404; + proxy_pass http://caches$request_uri; + } + location @caches_reordered { + proxy_store on; + proxy_redirect off; + proxy_store_access user:rw group:rw all:r; + proxy_next_upstream error timeout http_404; + proxy_pass http://caches/$2/$1/$3; } # Retrieve package from upstream mirrors and cache for future requests @@ -104,6 +120,11 @@ server { } +# other local mirrors +upstream caches { + server 1.arch.eckner.net; +} + # Upstream Arch Linux Mirrors # - Configure as many backend mirrors as you want in the blocks below # - Servers are used in a round-robin fashion by nginx |