話不多說,下面是NGINX的配置:
server {
listen 6333 ssl http2;
listen [::]:6333 ssl http2;
server_name xxxx;
index index.php index.html index.htm default.php default.htm default.html;
<pre><code>ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
error_page 497 https://$host$request_uri;
location / {
proxy_pass https://registry-1.docker.io; # Docker Hub 的官方映象倉庫
proxy_set_header Host registry-1.docker.io;
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;
# 關閉快取
proxy_buffering off;
# 轉發認證相關的頭部
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
# 對 upstream 狀態碼檢查,實現 error_page 錯誤重定向
proxy_intercept_errors on;
recursive_error_pages on;
# 錯誤處理和重定向邏輯
error_page 301 302 307 = @handle_redirect;
error_page 429 = @handle_too_many_requests;
}
location @handle_redirect {
resolver 1.1.1.1;
set $saved_redirect_location '$upstream_http_location';
proxy_pass $saved_redirect_location;
}
location @handle_too_many_requests {
return 429 "Too many requests, please try again later.";
}
access_log /www/wwwlogs/xianxian0827-6333.cloud.log;
error_log /www/wwwlogs/xianxian0827-6333.cloud.error.log;
</code></pre>
<p>} <br/> <br/>
"registry-mirrors": [<br>
"<a href="https://ip:6333" target="_blank">https://ip:6333</a>"<br>
]<br>