首页 > 解决方案 > Docker push nexus private repo 失败,413 Request Entity Too Large

问题描述

我已经部署了一个 Nexus OSS 的本地实例,它是在 Nginx 反向代理后面到达的。

在任何尝试将 docker 映像推送到在 Nexus 注册表上创建的存储库时,我都会 413 Request Entity Too Large在推送过程中碰到一个。

nginx.conf 文件如下所示:

http {
    client_max_body_size 0;
    upstream nexus_docker {
        server nexus:1800;
    } 
    server {
        server_name nexus.services.loc;
        location / {
            proxy_pass http://nexus_docker/;
            proxy_set_header Host $http_post;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        } 
    } 
} 

nginx 是使用 docker 部署的,我已经使用docker login. 我尝试了多个其他标志,例如 chunkin 等。但似乎没有任何效果。

标签: dockernginxnexus

解决方案


client_max_body_size这是因为您的服务器块在未设置时具有大约 1MB 大小的默认值。

要解决此问题,您需要将以下行添加到您的服务器块:

# Unlimit large file uploads to avoid "413 Request Entity Too Large" error
client_max_body_size 0;

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size


推荐阅读