From 30e040eab1abeb078377f973fc5b9651516667a9 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 16 Jun 2017 08:53:11 +0800 Subject: nginx: Rename apt-proxy.site.j2 -> nodes.site.j2, add location /nodes --- roles/nginx/templates/apt-proxy.site.j2 | 34 ----------------------- roles/nginx/templates/nodes.site.j2 | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 34 deletions(-) delete mode 100644 roles/nginx/templates/apt-proxy.site.j2 create mode 100644 roles/nginx/templates/nodes.site.j2 diff --git a/roles/nginx/templates/apt-proxy.site.j2 b/roles/nginx/templates/apt-proxy.site.j2 deleted file mode 100644 index 8c19f4c..0000000 --- a/roles/nginx/templates/apt-proxy.site.j2 +++ /dev/null @@ -1,34 +0,0 @@ -# -# /etc/nginx/sites-available/apt-proxy.site -# Nginx site: apt mirror proxy for LAN nodes -# - -server { - listen 80; - listen [::]:80; - - access_log /var/log/nginx/apt.access.log; - error_log /var/log/nginx/apt.error.log; - - allow {{ lan_network }}; - deny all; - - location /debian/ { - try_files $uri @mirror; - } - location /debian-security/ { - try_files $uri @mirror; - } - - location @mirror { - proxy_pass http://{{ apt_mirror }}; - proxy_next_upstream error timeout http_404; - proxy_set_header Host {{ apt_mirror }}; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - add_header X-Mirror-Upstream-Status $upstream_status; - add_header X-Mirror-Upstream-Response-Time $upstream_response_time; - add_header X-Mirror-Status $upstream_cache_status; - } -} diff --git a/roles/nginx/templates/nodes.site.j2 b/roles/nginx/templates/nodes.site.j2 new file mode 100644 index 0000000..df6c369 --- /dev/null +++ b/roles/nginx/templates/nodes.site.j2 @@ -0,0 +1,48 @@ +# +# /etc/nginx/sites-available/nodes.site +# Nginx site: +# * APT mirror proxy for LAN nodes +# * Serve extra files and configurations to nodes +# + +server { + listen 80; + listen [::]:80; + + access_log /var/log/nginx/nodes.access.log; + error_log /var/log/nginx/nodes.error.log; + + allow {{ lan_network }}; + deny all; + + root /srv/www; + index index.html index.htm; + + location /nodes { + # Allow directory listing output + autoindex on; + # Round file sizes kB, MB, GB + autoindex_exact_size off; + # Show times in local time zone + autoindex_localtime on; + } + + location /debian/ { + try_files $uri @mirror; + } + location /debian-security/ { + try_files $uri @mirror; + } + + location @mirror { + proxy_pass http://{{ apt_mirror }}; + proxy_next_upstream error timeout http_404; + proxy_set_header Host {{ apt_mirror }}; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + add_header X-Mirror-Upstream-Status $upstream_status; + add_header X-Mirror-Upstream-Response-Time $upstream_response_time; + add_header X-Mirror-Status $upstream_cache_status; + } +} -- cgit v1.2.2