Skip to content
Snippets Groups Projects
proxy-hosts.conf.j2 693 B
server { # simple reverse-proxy
    listen       443 ssl;
    server_name  {{ full_hostname }};
    root /var/www/html;

    index index.html;

    error_page 400 401 402 403 404 500 501 502 /index.html;

    ssl_certificate     /etc/letsencrypt/live/{{ full_hostname }}/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/{{ full_hostname }}/privkey.pem;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    {% set cnt = 253 %}
    {% for i in range(cnt) %}
    location /{{ i + 1 }} {
          return 302 /{{ i + 1 }}/;
    }

    location /{{ i + 1 }}/ {
      proxy_pass      http://192.168.69.{{ i + 1 }}:80/;
    }
    {% endfor %}
  }