File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,16 @@ http {
2323 # will run before forking out nginx worker processes
2424 init_by_lua_block { require "cjson" }
2525
26+ #https://docs.docker.com/registry/recipes/nginx/#setting-things-up
27+ map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
28+ '' 'registry/2.0' ;
29+ }
30+
2631 server {
2732 listen LISTEN default_server;
2833
34+ #AUTHCONFIG
35+
2936 # Cache
3037 add_header X-Cache-Status $upstream_cache_status ;
3138 proxy_temp_path /cache/temp 1 2;
5259 http_500 http_502 http_503 http_504;
5360 proxy_cache_lock on;
5461
62+ add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
5563 add_header "Access-Control-Allow-Origin" "*" ;
5664
5765 location / {
Original file line number Diff line number Diff line change @@ -46,13 +46,19 @@ if [ ! -z "$REGISTRY_HTTP_TLS_CERTIFICATE" ] && [ ! -z "$REGISTRY_HTTP_TLS_KEY"
4646 SSLINCLUDE=" include $SSLCONFIG ;"
4747fi
4848
49+ AUTHCONFIG=' '
50+ if [ ! -z " $REGISTRY_AUTH_HTPASSWD_PATH " ] && [ ! -z " $REGISTRY_AUTH_HTPASSWD_REALM " ]; then
51+ AUTHCONFIG=" auth_basic ${REGISTRY_AUTH_HTPASSWD_REALM} ;\n auth_basic_user_file ${REGISTRY_AUTH_HTPASSWD_PATH} ;"
52+ fi
53+
4954# Update nginx config
5055sed -i -e s! UPSTREAM! " $UPSTREAM " ! g $CONFIG
5156sed -i -e s! LISTEN! " $PORT $ENABLESSL " ! g $CONFIG
5257sed -i -e s! PORT! " $PORT " ! g $CONFIG
5358sed -i -e s! RESOLVER! " $RESOLVER " ! g $CONFIG
5459sed -i -e s! CACHE_MAX_SIZE! " $CACHE_MAX_SIZE " ! g $CONFIG
5560sed -i -e s! # SSLCONFIG!"$SSLINCLUDE"!g $CONFIG
61+ sed -i -e s! # AUTHCONFIG!"$AUTHCONFIG"!g $CONFIG
5662
5763# setup ~/.aws directory
5864AWS_FOLDER=' /root/.aws'
You can’t perform that action at this time.
0 commit comments