大佬们还在反代 docker 么,我这突然不能用了

49 天前
 glouhao

之前哪里抄的配置忘了,现在改成这里的: https://www.cnblogs.com/guangdelw/p/18253540 ,还是不管用,然后 AI 给我加了点,还是不行。

server {
    listen      80;
    listen 443 ssl;
    server_name dk.xxxxx.com;
    index index.html index.htm;
    root  /data/www/blog/;
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Headers' 'userTicket,ssotoken,token,Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Requested-With';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    send_timeout 600;
    client_header_buffer_size 128k;
    large_client_header_buffers 4 128k;
    proxy_buffer_size 64k;
    proxy_buffers 8 64k;
    ssl_certificate /etc/nginx/ssl/docker/fullchain.cer;
    ssl_certificate_key /etc/nginx/ssl/docker/xxxxx.com.key;
    
    # 处理 token 请求
    location /token {
        proxy_pass https://auth.docker.io/token;
        proxy_set_header Host auth.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;
    }

    # 处理 v2 API 请求
    location /v2/ {
        proxy_pass https://registry-1.docker.io/v2/;
        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;
        proxy_intercept_errors on;
        recursive_error_pages on;
        error_page 301 302 307 = @handle_redirect;
    }

    # 处理其他请求
    location / {
        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_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;
    }

    access_log  /data/www/logs/nginx/docker.access.log;
    error_log  /data/www/logs/nginx/docker.error.log;
}

求大佬们帮忙指点下

386 次点击
所在节点    问与答
2 条回复
YITWEI
47 天前
location / {
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_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;
}
glouhao
45 天前
@YITWEI #1 谢谢刚看见,又找了个别人的抄了管用了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1086210

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX