From e6ec92058bde81f02cb076870ba85df6cbb566ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu> Date: Fri, 10 Feb 2017 10:40:28 +0100 Subject: [PATCH] Changed APT proxy in skyreach Nginx conf (refs #20417). --- 2.Common_services/5.Nginx/vhost_skyreach.conf | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/2.Common_services/5.Nginx/vhost_skyreach.conf b/2.Common_services/5.Nginx/vhost_skyreach.conf index 269c1d4a..26c85389 100644 --- a/2.Common_services/5.Nginx/vhost_skyreach.conf +++ b/2.Common_services/5.Nginx/vhost_skyreach.conf @@ -1,3 +1,5 @@ +proxy_cache_path /tmp/nginx-uc-apt-cache levels=1:2 keys_zone=uc-apt-cache:10m max_size=4g inactive=300s; + server { listen 80; server_name {{ server_name }}; @@ -38,14 +40,33 @@ server { include /etc/nginx/uwsgi_params; } - # Ubuntu + # Old APT proxy urls location /fr.archive.ubuntu.com/ubuntu { - proxy_pass http://127.0.0.1:3142; + rewrite ^/(.*)$ /apt/http/$1?; } location /security.ubuntu.com/ubuntu { - proxy_pass http://127.0.0.1:3142; + rewrite ^/(.*)$ /apt/http/$1?; } location /old-releases.ubuntu.com/ubuntu { - proxy_pass http://127.0.0.1:3142; + rewrite ^/(.*)$ /apt/http/$1?; + } + # APT proxy + location /apt { + location ~ ^/apt/(http|https)/([\w\.\-\_]+.ubuntu.com/ubuntu|panel.ubicast.eu/packaging/apt)/(.*)$ { + resolver 127.0.0.1; + proxy_pass $1://$2/$3; + proxy_cache uc-apt-cache; + # do not consider secure urls as new files + proxy_cache_key $scheme$proxy_host$uri; + # only one request at a time will be allowed to populate a new cache element + proxy_cache_lock on; + # how long should the data be kept in the cache + proxy_cache_valid 200 7d; + # instruct browser to cache this + expires 7d; + # headers + proxy_ignore_headers "Cache-Control" "X-Accel-Expires" "Expires"; + add_header X-Cache $upstream_cache_status; + } } } -- GitLab