[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: nginx: mirror: Move locations to a separate file.
From: |
Ludovic Courtès |
Subject: |
01/02: nginx: mirror: Move locations to a separate file. |
Date: |
Thu, 10 Mar 2016 15:42:51 +0000 |
civodul pushed a commit to branch master
in repository maintenance.
commit 3f316d424747eacb82075fe99d7549e510424a31
Author: Ludovic Courtès <address@hidden>
Date: Thu Mar 10 16:32:52 2016 +0100
nginx: mirror: Move locations to a separate file.
---
hydra/nginx/mirror-locations.conf | 62 +++++++++++++++++++++++++++++++++++++
hydra/nginx/mirror.conf | 60 +-----------------------------------
2 files changed, 63 insertions(+), 59 deletions(-)
diff --git a/hydra/nginx/mirror-locations.conf
b/hydra/nginx/mirror-locations.conf
new file mode 100644
index 0000000..70eb279
--- /dev/null
+++ b/hydra/nginx/mirror-locations.conf
@@ -0,0 +1,62 @@
+# Configuration of the various locations being mirrored.
+# This file is meant to be included in the mirror configuration file.
+
+location /nix-cache-info {
+ proxy_pass http://hydra.gnu.org/nix-cache-info;
+
+ # Cache this file since that's always the first thing we ask for.
+ proxy_cache static;
+ proxy_cache_valid 200 10d; # cache hits for a looong time.
+ proxy_cache_valid any 5m; # cache misses/others for 5 min.
+ proxy_ignore_client_abort on;
+
+ # We need to hide and ignore the Set-Cookie header
+ # to enable caching.
+ proxy_hide_header Set-Cookie;
+ proxy_ignore_headers Set-Cookie;
+}
+
+location /nar/ {
+ proxy_pass http://hydra.gnu.org;
+
+ client_body_buffer_size 256k;
+
+ # Enable caching for nar files, to avoid reconstructing and recompressing
+ # archives.
+ proxy_cache nar;
+ proxy_cache_valid 200 8d; # cache hits for 8 days.
+ proxy_cache_valid any 1h; # cache misses/others for 1h.
+
+ proxy_ignore_client_abort on;
+
+ # Nars are already compressed.
+ gzip off;
+
+ # We need to hide and ignore the Set-Cookie header
+ # to enable caching.
+ proxy_hide_header Set-Cookie;
+ proxy_ignore_headers Set-Cookie;
+
+ # Provide a 'content-length' header so that 'guix substitute-binary'
+ # knows upfront how much it is downloading.
+ #add_header Content-Length $body_bytes_sent;
+}
+
+location ~ \.narinfo$ {
+ proxy_pass http://hydra.gnu.org;
+
+ # For HTTP pipelining. This has a dramatic impact on performance.
+ client_body_buffer_size 128k;
+
+ # Enable caching for narinfo files, to avoid recomputing nar signatures.
+ proxy_cache narinfo;
+ proxy_cache_valid 200 7d; # cache hits for 7 days.
+ proxy_cache_valid any 1h; # cache misses/others for 1h.
+
+ proxy_ignore_client_abort on;
+
+ # We need to hide and ignore the Set-Cookie header
+ # to enable caching.
+ proxy_hide_header Set-Cookie;
+ proxy_ignore_headers Set-Cookie;
+}
diff --git a/hydra/nginx/mirror.conf b/hydra/nginx/mirror.conf
index cf06a09..e9b6cca 100644
--- a/hydra/nginx/mirror.conf
+++ b/hydra/nginx/mirror.conf
@@ -64,64 +64,6 @@ http {
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- location /nix-cache-info {
- proxy_pass http://hydra.gnu.org/nix-cache-info;
-
- # Cache this file since that's always the first thing we ask for.
- proxy_cache static;
- proxy_cache_valid 200 10d; # cache hits for a looong time.
- proxy_cache_valid any 5m; # cache misses/others for 5 min.
- proxy_ignore_client_abort on;
-
- # We need to hide and ignore the Set-Cookie header
- # to enable caching.
- proxy_hide_header Set-Cookie;
- proxy_ignore_headers Set-Cookie;
- }
-
- location /nar/ {
- proxy_pass http://hydra.gnu.org;
-
- client_body_buffer_size 256k;
-
- # Enable caching for nar files, to avoid reconstructing and
recompressing
- # archives.
- proxy_cache nar;
- proxy_cache_valid 200 8d; # cache hits for 8 days.
- proxy_cache_valid any 1h; # cache misses/others for 1h.
-
- proxy_ignore_client_abort on;
-
- # Nars are already compressed.
- gzip off;
-
- # We need to hide and ignore the Set-Cookie header
- # to enable caching.
- proxy_hide_header Set-Cookie;
- proxy_ignore_headers Set-Cookie;
-
- # Provide a 'content-length' header so that 'guix substitute-binary'
- # knows upfront how much it is downloading.
- #add_header Content-Length $body_bytes_sent;
- }
-
- location ~ \.narinfo$ {
- proxy_pass http://hydra.gnu.org;
-
- # For HTTP pipelining. This has a dramatic impact on performance.
- client_body_buffer_size 128k;
-
- # Enable caching for narinfo files, to avoid recomputing nar
signatures.
- proxy_cache narinfo;
- proxy_cache_valid 200 7d; # cache hits for 7 days.
- proxy_cache_valid any 1h; # cache misses/others for 1h.
-
- proxy_ignore_client_abort on;
-
- # We need to hide and ignore the Set-Cookie header
- # to enable caching.
- proxy_hide_header Set-Cookie;
- proxy_ignore_headers Set-Cookie;
- }
+ include mirror-locations.conf;
}
}