@
fibroblast #15
配置文件:
server {
listen 80;
listen [::]:80;
server_name
docker.beitai.cc;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name
docker.beitai.cc;
ssl_certificate /huo/ssl/beitai_cc.pem;
ssl_certificate_key /huo/ssl/beitai_cc.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
# 启用 OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 10s;
location / {
root /huo/html/docker;
index index.html;
}
# 主 Docker 服务配置
location /v2/ {
proxy_pass
https://registry-1.docker.io;
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_request_buffering off;
proxy_http_version 1.1;
proxy_read_timeout 7200s;
proxy_send_timeout 7200s;
send_timeout 7200s;
proxy_connect_timeout 7200s;
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 301 302 307 = @
handle_redirect;
}
# 重定向处理
location @
handle_redirect {
resolver 1.1.1.1;
set $saved_redirect_location '$upstream_http_location';
proxy_pass $saved_redirect_location;
}
}