<commit_before># This config is based on the config at:
#
#   https://github.com/docker/docker-registry/blob/master/contrib/nginx/nginx_1-3-9.conf
#
# For versions of nginx > 1.3.9 that include chunked transfer encoding support

upstream docker-registry {
  server <%= ENV['REGISTRY_SERVER'] %>;
}

server {
  listen 443;
  server_name <%= ENV['SERVER_NAME'] %>;

  ssl on;
  ssl_certificate <%= ENV['CERT_FILE'] %>;
  ssl_certificate_key <%= ENV['KEY_FILE'] %>;

  client_max_body_size 0; # disable any limits to avoid HTTP 413 for large image uploads

  # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
  chunked_transfer_encoding on;

  location / {
    auth_basic            "Restricted";
    auth_basic_user_file  /etc/nginx/conf.d/docker-registry-proxy.htpasswd;
    proxy_pass            http://docker-registry;
    proxy_set_header      Host           $http_host;   # required for docker client's sake
    proxy_set_header      X-Real-IP      $remote_addr; # pass on real client's IP
    proxy_set_header      Authorization  "";  # see https://github.com/dotcloud/docker-registry/issues/170
    proxy_read_timeout    900;
  }

  location /_ping {
    auth_basic off;
    proxy_pass            http://docker-registry;
    proxy_set_header      Host           $http_host;   # required for docker client's sake
    proxy_set_header      X-Real-IP      $remote_addr; # pass on real client's IP
    proxy_set_header      Authorization  "";  # see https://github.com/dotcloud/docker-registry/issues/170
    proxy_read_timeout    900;
  }

  location /v1/_ping {
    auth_basic off;
    proxy_pass            http://docker-registry;
    proxy_set_header      Host           $http_host;   # required for docker client's sake
    proxy_set_header      X-Real-IP      $remote_addr; # pass on real client's IP
    proxy_set_header      Authorization  "";  # see https://github.com/dotcloud/docker-registry/issues/170
    proxy_read_timeout    900;
  }
}<commit_msg>Add /v2/ location to template.<commit_after># This config is based on the config at:
#
#   https://github.com/docker/docker-registry/blob/master/contrib/nginx/nginx_1-3-9.conf
#
# For versions of nginx > 1.3.9 that include chunked transfer encoding support

upstream docker-registry {
  server <%= ENV['REGISTRY_SERVER'] %>;
}

server {
  listen 443;
  server_name <%= ENV['SERVER_NAME'] %>;

  ssl on;
  ssl_certificate <%= ENV['CERT_FILE'] %>;
  ssl_certificate_key <%= ENV['KEY_FILE'] %>;

  client_max_body_size 0; # disable any limits to avoid HTTP 413 for large image uploads

  # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
  chunked_transfer_encoding on;

  location / {
    auth_basic            "Restricted";
    auth_basic_user_file  /etc/nginx/conf.d/docker-registry-proxy.htpasswd;
    proxy_pass            http://docker-registry;
    proxy_set_header      Host           $http_host;   # required for docker client's sake
    proxy_set_header      X-Real-IP      $remote_addr; # pass on real client's IP
    proxy_set_header      Authorization  "";  # see https://github.com/dotcloud/docker-registry/issues/170
    proxy_read_timeout    900;
  }

  location /_ping {
    auth_basic off;
    proxy_pass            http://docker-registry;
    proxy_set_header      Host           $http_host;   # required for docker client's sake
    proxy_set_header      X-Real-IP      $remote_addr; # pass on real client's IP
    proxy_set_header      Authorization  "";  # see https://github.com/dotcloud/docker-registry/issues/170
    proxy_read_timeout    900;
  }

  location /v1/_ping {
    auth_basic off;
    proxy_pass            http://docker-registry;
    proxy_set_header      Host           $http_host;   # required for docker client's sake
    proxy_set_header      X-Real-IP      $remote_addr; # pass on real client's IP
    proxy_set_header      Authorization  "";  # see https://github.com/dotcloud/docker-registry/issues/170
    proxy_read_timeout    900;
  }

  location /v2/ {
    # Do not allow connections from docker 1.5 and earlier
    # docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents
    if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
      return 404;
    }

    # To add basic authentication to v2 use auth_basic setting plus add_header
    auth_basic            "Restricted";
    auth_basic_user_file  /etc/nginx/conf.d/docker-registry-proxy.htpasswd;
    add_header            'Docker-Distribution-Api-Version' 'registry/2.0' always;

    proxy_pass                          http://docker-registry;
    proxy_set_header  Host              $http_host;   # required for docker client's sake
    proxy_set_header  X-Real-IP         $remote_addr; # pass on real client's IP
    proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Proto $scheme;
    proxy_read_timeout                  900;
  }
}
{'fraction_non_alphanumeric': 0.10036130068245684, 'fraction_numerical': 0.021678040947410677, 'mean_word_length': 2.6774907749077492, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1556157', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1553, 'n_words': 370}