server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name docker.hatthieves.es registry.hatthieves.es;
  chunked_transfer_encoding on;
  client_max_body_size 2G;
  location / {
#     if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
#       return 404;
#     }
    auth_basic "Registry realm";
    auth_basic_user_file /etc/nginx/registry.htpasswd;
    add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
    proxy_pass http://172.110.0.101:5000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    # Mitigate httpoxy attack (see README for details)
    proxy_set_header Proxy "";
    proxy_read_timeout 900;
  }
}
map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
  '' 'registry/2.0';
}
