aboutsummaryrefslogtreecommitdiff
path: root/files/usr/local/etc/nginx/vhosts.conf.pkg_repository
blob: 73c57549972d19001c40c892bd53ed50550d5732 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
server {
  listen       0.0.0.0:80 default_server;
  listen       [::]:80    default_server;
  listen       443      ssl default_server;
  listen       [::]:443 ssl default_server;
  server_name  ${fqdn};
  root         ${poudriere_data_dir}/data/packages;

  ssl_certificate      ${poudriere_https_cert};
  ssl_certificate_key  ${poudriere_https_key};

  include mime.types;
  types {
    text/plain  log;
  }

  location /poudriere/ {
    alias /usr/local/share/poudriere/html/;

    # Allow caching static resources
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|woff|css|js|html)$ {
      add_header Cache-Control "public";
      expires 2d;
    }

    location /poudriere/data {
      alias ${poudriere_data_dir}/data/logs/bulk;

      # Allow caching dynamic files but ensure they get rechecked
      location ~* ^.+\.(log|txz|tbz|bz2|gz)$ {
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
      }

      # Don't log json requests as they come in frequently and ensure
      # caching works as expected
      location ~* ^.+\.(json)$ {
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        log_not_found off;
      }

      # Allow indexing only in log dirs
      location ~ /poudriere/data/?.*/(logs|latest-per-pkg)/ {
        autoindex on;
      }
    }
  }

  location / {
    autoindex on;
  }
}