guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: hydra: nginx: Add configuration file for mirrors.


From: Ludovic Courtès
Subject: 02/02: hydra: nginx: Add configuration file for mirrors.
Date: Tue, 01 Mar 2016 13:29:40 +0000

civodul pushed a commit to branch master
in repository maintenance.

commit c59bb59eddfff4d4a2fea326ebebf9b8cce03df9
Author: Ludovic Courtès <address@hidden>
Date:   Tue Mar 1 14:29:09 2016 +0100

    hydra: nginx: Add configuration file for mirrors.
---
 hydra/nginx/mirror.conf |  127 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/hydra/nginx/mirror.conf b/hydra/nginx/mirror.conf
new file mode 100644
index 0000000..af4498e
--- /dev/null
+++ b/hydra/nginx/mirror.conf
@@ -0,0 +1,127 @@
+# This is the /etc/nginx/nginx.conf file for mirrors.
+
+user www-data;
+worker_processes  1;
+
+error_log  /var/log/nginx/error.log error;
+pid        /var/run/nginx.pid;
+
+lock_file  /var/lock/nginx.lock;
+
+pcre_jit   on;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    default_type  application/octet-stream;
+
+    client_body_temp_path /var/lib/nginx/body;
+    proxy_temp_path       /var/lib/nginx/proxy;
+
+    access_log /var/log/nginx/access.log;
+
+    sendfile        on;
+
+    # Maximum chunk size to send.  Partly this is a workaround
+    # for <http://bugs.gnu.org/19939>, but also the nginx docs
+    # mention that "Without the limit, one fast connection may
+    # seize the worker process entirely."
+    # <http://nginx.org/en/docs/http/ngx_http_core_module#sendfile_max_chunk>
+    sendfile_max_chunk 1m;
+
+    keepalive_timeout  65;
+
+    # cache for narinfo files
+    proxy_cache_path /var/cache/nginx/narinfo
+                    levels=2
+                    inactive=72h          # inactive keys removed after 72h
+                    keys_zone=narinfo:8m  # narinfo meta data: ~64K keys
+                    max_size=4g;          # total cache data size max
+
+    # cache for nar files
+    proxy_cache_path /var/cache/nginx/nar
+                    levels=2
+                    inactive=96h          # inactive keys removed after 96h
+                    keys_zone=nar:8m      # nar cache meta data: ~64K keys
+                    max_size=100g;        # total cache data size max
+
+    # cache for static data
+    proxy_cache_path /var/cache/nginx/static
+                    levels=1
+                    inactive=48h          # inactive keys removed after 2 days
+                    keys_zone=static:1m   # nar cache meta data: ~8K keys
+                    max_size=2m;          # total cache data size max
+
+    server {
+       listen       80;
+       server_name  hydra.gnu.org;
+
+       access_log  /var/log/nginx/hydra.access.log;
+
+       proxy_set_header X-Forwarded-Host $host;
+       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 100h;  # 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 96h;   # cache hits for 4 days.
+           proxy_cache_valid any 10m;   # cache misses/others for 10 min.
+
+           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 72h;  # cache hits for 3 days.
+           proxy_cache_valid any 10m;  # cache misses/others for 10 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;
+       }
+    }
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]